Inside Look: Flame Trap

For those of you who don’t know, the PC build of SUPER III is currently being developed in Game Maker: Studio. Some believe that GM is an inadequate programming tool, but I find that it is great for what I do and I wanted to share some of the tricks that I have learned along the way.

In this series I’ll talk a bit about GM code and a bit about how to polish the edges of your game concept to add “JUICINESS”. I hate that term, but I’m going to roll with it.

To begin, I’m going to discuss a single game object that I have recently implemented into WORLD 3 of our current project, SUPER III. A few people have already asked how I got the fire to look the way it does, and the answer is quite simple: minimize art and maximize your manipulation of the art.

The fire trap actually consists of two objects. The first one, “oFlame”, simply plays this small explosion animation.


That’s it. That’s literally the only “fire” art we have in the game at this point. It’s the second object, oFlameTrap, that does all of the work. After being triggered by the player, the flame trap runs the following code every frame, for 15 frames.

with (instance_create(x + 8, y + 12, oFlame)) {
    image_angle = random(360);

    hspeed = random_range(-0.5, 0.5);
    vspeed = -random_range(2, 4);

    image_speed = random_range(0.25, 0.75);

Is it efficient, not really? Does it work? Yes, and it looks how I want it to look. Part of making independent games is knowing that perfect engine architecture and program design is NOT number one. DO WHAT WORKS.

For those of you who are new to GM, this is what’s going on:

1) Choose a random angle at which to draw the sprite attached to oFlame.
2) Select a random (but slow) speed for the flame to be moving horizontally.
3) Select a random (but quite a bit faster) speed for the flame to be moving vertically.
4) Select a speed for the sprite animation to play at (this makes some flames last longer than others).

It is a simple process and it gives you the following as a result…


There are also other small things that make the trap work well. For one, the flames only damage the player for the first half of their animation cycle. This allows the player to safely jump through the smoke towards the top of the flame bursts. Also, the trap base shakes for 8 frames prior to releasing any flame objects. This is done simply by drawing the sprite at a random offset.

That’s all for now. Let me know if you would like more small articles like this in the future!




2 thoughts on “Inside Look: Flame Trap

  1. I am quite new to GM and seeing cool effects explained like this – as in, pictured with progress/results alongside – I always find really useful. It’s one thing seeing a chunk of code, but seeing the end result in a format like this makes it that little bit clearer, at least for me anyway. I always find myself learning more (and being able to recall) from YouTube videos than textbooks, for example. This isn’t hard nor does it require a lot of explanation, but the end result looks pretty damn great, in my opinion. So many of these effects are actually quite simple – but it’s not until you see how they’re created that you can appreciate how easy adding JUICINESS can be 😉

    As an idea for another article, how about an explanation of the moving ‘spacey particles’ in the background?

    The game is looking really good btw – lovely pixel art, my compliments to the artist!

  2. Hey, thanks! I will definitely be doing more of these posts in the near future. I can throw the ‘spacey particles’ into my pot of ideas.

    Thanks again!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s