GameMaker: Collision with 2d array


How it looks and how it is internally

This example demonstrates how to organize system where some level information is presented as a 2-dimensional array (item data indicating block index), and organize collisions with that.

Could basically say that this is a smaller version of my Terra example. Except simpler, using arrays, and Lite-compatible. As well it does not support truly infinite worlds (has a 32000x32000 limit), but target user is not likely to need that anyway.

Download GMK

GameMaker: Coins, floating text, basic shop

GameMaker example - coins, floating text, basic shop
Let's just say that art assets for this example are from abstract collection.

While I have made this example a long time ago, it appears that questions about such still are common, and thus it would make sense to give it a 'searchable form' of post here.
This example demonstrates creation of 3 things:
  • Coins, as a basic collectable item.
  • Floating text, which is used here to display '+1' on picking up a coin, but has many other uses.
  • Shops, as objects that sell you useful (or here, useless) things for coins.
Overall, rather simplistic, however still useful for ones that do not know what they're doing with these.

Download GMK

GameMaker: ‘strategy’ unit selection

Today I've made a simple example for strategy-like unit selection.
That is, selecting units (instances) with mouse, with selection rectangle and selected units being displayed accordingly.
Example is well-commented and should be easy to use.
Principle of work is simple - to detect units that overlap selection rectangle, game should cycle through them, performing collision_rectangle checks. Amount of calculations and code complexity is cut here by local variable usage (if you did not know, local variables 'var' will be available inside of with constructions without any prefixes).

Download GMK

Source code follows,

Continue reading

GameMaker: Taking screenshot of area larger than screen


Above: in-game view. Below: taken screenshot of entire room

This is an example that I've actually made a long time ago, but apparently it remains a common unresolved problem.
For multiple cases you may need to take a screenshot (or copy to surface) entire room, while only portion of it can be seen at once (window/screen size limitations).
A perfect work-around for this is to force screen drawing into a surface of chosen size, after adjusting view settings.

Download GMK

Minecraft: Sometime, modding

I was playing Minecraft often in past days, and once again have came to thoughts that start from phrase "I wish there was...".
As result, I've got to 'playing around' with source of Zombe's ModPack.
This mod already adds some nice additions for single-player and survival multi-player, and most of my edits turned out to be experimental, or something that only I might see use of.
So, these are...

Continue reading

Time is Ticking (gadget for windows vista/7)


Looks of gadget on desktop, in according pane, and on it's settings screen.

So I've randomly found out that Windows 7 (and Vista too) gadgets are written in HTML+JS+CSS.
Next thing I did was writing my own gadget. So this comes.

'Time is Ticking' is a minimalistic stopwatch. As such, it's purpose is to allow measuring for how long you were doing (or not doing) specific thing. Can be motivating.
Gadget can be considered optimized (does operation and a redraw once per second when on, is entirely idle when off), features customizable backgrounds with ability to specify your own (navigate to %USERPROFILE%\AppData\Local\Microsoft\Windows Sidebar\Gadgets\TimeIsTicking.gadget\image and add 160x32 PNG images to be able to chose them by-name in settings), and is pretty nice-looking overall.
For best experience it is recommended that you have font Dejavu Sans Mono installed, so digits would display appropriately.
To avoid accidental triggering, pause\restart buttons require double-clicking them to react.

Download

CPP – [busy] sleep() function via time.h

As you may know, there are multiple ways to create a sleep\delay function in C++.
These may appeal more or less to you depending on system and libraries available.
The following short function uses functionality of time.h header, which makes it useful for cases when dos.h is missing and you do not want to include windows.h just for a single function.

void sleep(int ms) {
	clock_t target = clock() + ms;
	while (clock() < target) { }
}

AS3: MinimalFramework


Trivia: Compiled SWF seen on this image takes less space than an image of it.

I made this tiny "framework" some time ago and successfully used it for a handful of jam games, including those with size restrictions (such as Pipe10).

Structurally it is inspired by FlashPunk, and includes a 04b03 lookalike font compressed into 1.3KB worth of data.

See code (Gist)