GameMaker: Cycling random funky text

The idea behind this effect is simple enough - for every string character that should be randomized, replace it with any other character that has same width (so that the drawn string would not wiggle chaotically).

It uses 3 scripts total - one for general initialization, one for per-font init (creating a map of lists for what glyphs any given one could be replaced with), and one for actual string processing.

Can be handy for various abstract pieces, or as an interesting way to censor text.

Download GMK Live demo

Text versions follow,

Continue reading

GameMaker: Circular cooldown rectangle

GameMaker: Cooldown rectangle

I do not know the exact name of this visual effect (angular/clockwise fade-in/fade-out?), but it is one of the most common things that you can see in interface of RPG and RTS games, displaying progress of construction/upgrade/ability cooldown. So, to the point...
You can read how this is actually being implemented, or just scroll down to the bottom of post and grab the code and/or GMK file.
Implementation of such is actually pretty simple, Continue reading

GameMaker: View following two objects at once


This example is going to be of great use for everyone making local multi-player games, as well games requiring to display two objects on screen at once generally.
Effect here is, that view is positioned and scaled (if needed), to include two given instances at once.
Example provides a single function that does this sort of trick for you, absolutely painlessly and easily.

Download GMK

GameMaker: Pointing to an off-screen object


Illustration

This intermediate example demonstrates, how to create a rather nice interface element being an arrow that points between a on-screen object (normally player) and a off-screen location, that needs to be reached. In this case, arrow indicates exact direction to target, and is made to clamp accurately to screen edges (preserving direction vector), to avoid confusion on behalf of player.
Such feature is specifically useful for exploration games, where goal(s) may be at different distance from player, and some guidance is required.

Download

Source code follows,

Continue reading

GameMaker: “notification” window


In the example, 'notifier' is just being annoying on purpose

This is an example for adding smooth-looking slide effect to game's window in GameMaker.
I suppose that ones to use my old program 'GMConverter' might have seen it there.
Despite of simplicity, it doesn't seem to be a common thing to see in games and applications.
Taking low ability of people to understand my original code, this example is well-commented and attempts to simplify usage where possible.

Download

Continue reading

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: Surfaces and scrollable content

In some cases, a moment comes when you need to display specific content in a area smaller than itself, thus requiring scrolling.

GameMaker does not support 'clip rectangle' type of command for its reasons, however it is easy to 'clip' area to be drawn by using an 'buffer' surface to draw content in, before drawing that to screen.
Attached example illustrates sample implementation of such.

Most often, content of such would be text. And maybe an image. Or two.

Since images would require a bit more code, example does simple and efficient - long long text is rendered into a surface, which is later drawn into an other 'buffer' surface to display it as part of window on screen.
Also there is a scrollbar, which obviously can be improved, if it needs to serve purposes other than displaying position of 'window'.

Download