Day 19 — Aspiring Game Creator
2D Game Dev: Galaxy Shooter
Objective: Create a Retro Game Over behavior
- When the player death sequence is triggered the game is put into non interactive mode.
- The “Restart Game” text is enabled.
- The “Game Over” text is enabled.
- Change the colors of the “Game Over” text.
- Allow the player to insert a token for a replay (either 1 or L is accepted, L looks like 1).
Below, the code to create the Retro Game over behavior is straightforward.
After getting a handle to the text element, a FOR LOOP is used to count to 60, using the modulus operator “%”, if divisible by 2, the text is red, if divisible by 3, the text is blue, otherwise the text is white.