2 Player Battle Simulator Step 6: Powerup

In this blog I will show you how to add a powerup to your game. This powerup will give whichever character touches 1 more health. This could be very helpful if a character loses health he could regenerate it.

To start as always we will need to get a sprite I chose this yellow-orange star and as always you can choose whatever sprite you want.

Now that we have our sprite we will start to add our code and as a fare warning it is pretty complicated but i’m sure you can handle it.

This is the code for the power up

Now this is the code that the powerup will follow. I will briefly explain what it does. First it goes toa specific place on the battlefield and it hides it self. Next is moves around the map slowly and then it shows itself for 2.5 seconds and then hides itself and it can appear anywhere between 15 and 25 seconds.

So that’s the basics of how the powerup code but now we need to add the code to the Knight and the Warlock. The two codes are pretty similar but we will start with the Knight.

Now that we have this code added to the Knight when it touches the powerup it will get an additional health and if the Knight touched the power up without this code it would not do anything. Now that we finished the code for the Knight we have to add it for the Warlock.

As you can see the codes are virtually the same except for the variable block but other than that they function the same way.

Thats going to be it for this Blog thank you all for reading I hope you enjoyed and learned Subscribe to my YT: @Drago Gaming https://www.youtube.com/channel/UCrlNUqQVBxLIbdltHQBdcYg?