MERCH!
Giant Bomb - a website about video games and the people that make them

I'm Makin' A Game: Multipliers and Such Take 2

by fobwashed

This is a somewhat smaller update to my previous post but the work that went into it was no small task -_-;; Here's the vid, and following I'll do a slightly more in depth look at the process behind creating something that seems so simple. Finished look Here's a screen of the actual multiplier light thing up close. The parts that make the whole And here's a breakdown of all the parts as it is i...

This is a somewhat smaller update to my previous post but the work that went into it was no small task -_-;; Here's the vid, and following I'll do a slightly more in depth look at the process behind creating something that seems so simple.

Finished look

Here's a screen of the actual multiplier light thing up close.

The parts that make the whole

And here's a breakdown of all the parts as it is in the spritesheet.

I apologize for the ridiculous watermark, but I'd rather be safe than have my stuff appear elsewhere -_-;;

The order that it's drawn and put together is the second row, right hand side glow is drawn first in the very back followed by the unlit number panel on the top right, then the number glow (bot row), the lit numbers in the row above the bot then the glass casing+mesh in the second row.

What I wanted the damn thing to do

The way I have the actual coding set up, is a lot more complicated than it has any right to be -_-;; To break down how it was put together, I first need to explain the things I wanted to happen. Here's a list!

  • Slow pulsating regardless of anything else
  • When a number changes, old number slowly cools away
  • As multiplayer gauge increases, glow intensifies

For such a short list of demands, it took a lot of doing.

Simplified explanation of the code

Here's where the boring stuff comes in. Some of this stuff is going to require a bit more explanation than I'm really willing to write down, but I'll try to make it simple enough for anyone interested to get the jist of it. EDIT: So, I wrote it down and I'm comin back up here to say, it's a dirty read. It's not very well written and may be more confusing than it's worth to read, but it's there -_-;; I'll answer any questions anyone might have about it if they'd like.

The setup

First thing I did was create source rectangles for each and every number and it's corresponding glow that contained the location of the individual numbers on the spritesheet. I also made three source rectangle containers that would be used to draw the number glowing, the current active number, and the currently deactivated number.

Two bools (true or false). one for whether or not the glow was increasing (isTubeGlowUp) and one for whether or not the old number was currently cooling down (isTubeCoolingDown).

Two floats (decimal number). One for the pulsing alpha amount on the glows, and one for the alpha amount of the cooling down number.

The main glow and pulsating

For the base amount that the currently active number would be glowing, I used the percentage that the multiplier gauge was full (number between 1~0.0) and lerp it between the minimum amount of alpha I want (0.4) and the maximum (0.8) based on that percentage. This causes the active number and the glows to increase when the gauge is getting to its max, and decreasing when it starts to fall down.

For the pulsating glow that is happening apart from the main glow amount, I use that float and bool I created earlier. If isTubeGlowUp is true, I add 0.005 to the float every update until it reaches 0.2. When it hits 0.2, I change isTubeGlowUp to false and when it updates and that bool reads false, it will subtract 0.005 from the glow amount every update until it reaches 0. At which point it's set up to change the isTubeGlowUp back to true. This repeats and that float amount is added to the main glow amount. This is also why the main glow is set to max out at 0.8 because if that's at max, and the pulse glow is at max, that equals the full amount.

That takes care of the pulsating, and the glow increasing with the gauge.

The number cooling away

When the number in the tube changes from one to another, I run a method that determines which number should currently be drawn. When this happens, the two containers that hold the number and corresponding number glow is filled with the proper source rectangle. After this happens, the third container is filled with what was the previous number so that it can be drawn cooling down. The isTubeCoolingDown is also switched from false to true. When this is read true, the alpha float for the cooling down is subtracted from every update till it hits a predetermined threshold at which point, it changes the bool to false, and resets that alpha to full so that it's ready for the next draw.

That's it for now

Yup, that's it for now. I also demonstrate the screen safe mode and how it effects the hud because I forgot to show it in the last vid. I'll post more eventually.