Developer’s Blog #4: Making a Gimmick

February 10, 2015

Welcome back to another developer’s blog, this time we’ll be taking at how we design a certain gimmick in the fifth stage, Breakout Prison, where Brock finds himself in the high security Navadash Prison.


Jump in to get this blog post started!

In this particular blog we’ll be looking about the design process that went into making the spotlight. Some context on the level itself, the player will find herself/himself confronting all manners of traps that have been activated to deter any prisoners in trying to escape from laser beams, spikes hidden in the floor, trapdoors and the gimmick we’ll be focusing on this blog the spotlight that activates the flamethrower! Just like the museum, we’re not quite sure why a prison has a flamethrower…

The level itself has one thing that differentiates it from the previous 4 levels and that is a distinct lack of bad guys, save for the 5 hidden through out the level that help the player reach the maximum attack bonus. Outside of that the player will simply be facing an onslaught of gimmicks that will attempt to impale, fry and electrocute our poor reptilian friend. With this in mind it really came down to making sure the gimmicks themselves had a bit more personality and above all else, managed to combine well together when placed in succession or together.

The most important one would be the spotlight. I broke it down in two parts, first of all the spotlights that alternate between themselves and then the flames that start shooting out if the player is detected. First of all required research, as people are aware of by now that with Brock Crocodile we’re attempting to create a platformer from around the 90s. There were plenty of methods I found on how to do a flamethrower but all of them seemed far too advance so I decided to play some good old fashion classics from the 1990s.


The frame that all the fun was had

After seeing how it was done in SEGA’s 1994 release Sonic & Knuckles (Who says games don’t teach you anything!) it came down to trying to emulate it. This brought a lot of fun and quirky techniques that I learned after messing around with the Sine and Cos that should definitely provide some future use for me! Now to tell you how it’s done, I’m sure there is a more effective way of doing it but for someone who hardly programmed it worked almost as I wanted it to.

The mask that creates the flame, which we shall call the generator from now on, has four different versions (Up, down, left and right.) and one alterable value (Flame direction.) In the initial testing the game would create a dozen or so new flames every 5 seconds at each specific generator points. Once the flame hits the generator, a specific alterable flame in the flame would change (from 0 – 3 representing up, down, left and right.) once this happens, the current y position of the flame would be subtracted by 1 or plus 1 depending if it was going up or down and like wise for the x position if it was going left or right.

The second alterable value is a bit more tricky and makes it needlessly longer. Everytime a flame hits the generator,  the generator’s type of movement value would go up by 1. This same value is copied into the flame’s alterable value for type of movement so it knows if it needs to be more slightly left, be in the centre or slightly right allowing for a slight “wavey” movement. Depending on the type of movement, the movement value of the flame would change (From -6 to +6) and a forumla is used to calculate just where the flame should be. In this case it would be;

[Set X position to X( “Flame” )+(Sin(Movement( “Flame” )))]

Now depending on how far I want the flame to be to the right or left, a multiplication will occur. Finally after the flame reaches the end of it’s life cycle (Around .35 seconds.) it extinguishes, leaving its slightly younger predecessors to take the reigns as the top flame for the remaining .10 seconds of its life, ha!

Next up the much less frustrating thing was to make the spotlights. The spotlights are controlled by an object, called the Prison_System from now on, in the background that makes use of it’s 5 alterable values (BrockSEEN, BrockACTIVATION, FlamecreationTimer and LightSwitch.) Whenever Brock overlaps a spotlight, BrockSEEN changes from 0 to 1 and 1 is constantly added to BrockACTIVATION and FlamecreationTimer whilst BrockSEEN equals 1. During this time the FlamecreationTimer creates one flame at the various generators and is reset to 0 every time it reaches 6 so we don’t have an overload of flames!



Some crocs just want to watch the world burn.

Though you may ask how does Brock get past these spotlights? That one is easy, the LightSwitch is constantly adding 1 until it reaches the maximum of 120 when it’s reset to 0. At each successive 40, one light switch turns on and the other two turn off. A very simple system for a rather complicated secruity system in a prison! All in all, 3 days of work saw me complete the system which I think looks rather pretty and retro in motion. There’s still somethings to sort out (Such as where exactly the fire comes from.) but for now enjoy this GIF.

I believed I’ve covered everything and hopefully you can take away with you the sort of planning that goes on behind the scenes to get something as simple as a flame to work in a game! I must admit when I first started working on Brock my preparation for gimmicks was step by step, I was just winging it, nowadays I plan beforehand, what is the system’s purpose? How is it going to do? How many parts is there to it etc and it’s helped me give greater admiration to some of the industry’s best programmers in the past and future who had to deal with vastly more complicated systems!


Thanks again for reading and you can always share the link via our share buttons above the topic title, until next time!