2D Game Dev Journey — Day 7: Shield Powerup

Gabe Gomez
2 min readMay 3, 2021


Welcome to 2D Game Dev Journey — Day 7: Shield Powerup. Today I will be further modularizing my code to include a shield powerup.

Starting Point & Setup

Today we will be starting right where we left off in 2D Game Dev Journey — Day 6: Speed Powerup. As in the article just mentioned, I took similar steps when it came to the setup for today’s work and went ahead creating my shield powerup sprite animated and ready to be coded in.

Shield Powerup animation

Implementing the Shield Powerup

To include the shield powerup, I utilized the enum I had created in the previous article. As you can see below, I can now select between three different shield types.

In my code, I use a switch statement to help determine what functions to run depending on which power-up type each asset is set to. The below GIF is the result of all three power-up types being properly implemented.


Thanks for checking in and reading today’s article. Tomorrow, I will start to create the UI to visualize many of the features we have implemented. As always, comments and critiques are welcome. If I have made any mistakes, please let me know so I can correct them for future readers. If you would like a more in-depth tutorial about anything I went over today, let me know and I will take the time to write something up.