Changing Sprites Using Code For My Armor Powerup

David Hunter Thornton
2 min readSep 15, 2022

--

Objective: Implement a new Armor Powerup that will change the visuals of the current sprite on the player.

Time for another Powerup that will increase the amount of health the player has. To start let’s set up the basics for the Powerup.

Next I need to add a simple Method that will increase the players “_lives” by 1 every time the powerup is collected. I also need to create a maximum number of lives.

Next is just to make sure that the life powerup calls the new method when the player collects it.

The logic for the next part is fairly simple. I’m just going to change the sprite for the player, based on how many lives the player currently has.

And lastly all I need is to drag each of the correct sprites into the appropriate Inspector fields.

You can now play this game on itch.io! I’ll try to keep it updated as I work on it and add new features or tweak existing ones.

……………………………………………………………………………………….

Shameless Plug: If you like my stuff, be sure to check me out on other social media platforms and join the BornAngry Games Discord!

YouTubeTwitchLinkedInFacebookTwitterPortfolioDiscord

--

--