2D Game Dev Journey — Day 7: Shield Powerup

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.

Conclusion

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.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Katalyo (KTLYO) DeFi Adds Liquidity to Emiswap

Stack Data Structure

Thinking about Syncing, Part 3: separation of concerns

10 free stock photos you would actually use (Wednesday 18th 08AM edition)

8 Effective Ways to Solve Outlook Error 0x800CCC0B

Discipline is perceived to be much harder than suffering ill effects of indisciplined work

Campus Placements- SDE

Sending Microsoft Teams messages using Webhooks and the Nintex Workflow Cloud.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gabe Gomez

Gabe Gomez

More from Medium

HMS KIT Use Case: Food & Drink Ordering App

Old Panasonic,Gionee Phones at risk Part2

Log4j zero-day attack: What is it and how to protect yourself?

Damage VFX using Animated Sprites in Unity