**This is an old revision of the document!**

8. Powerups


Adding powerups

We will add two objects called “PowerupHealth”, and “PowerupShield”. Select the “powerup_health.png” image from the assets folder for the health object. Repeat the same process for shield object by choosing the “powerup_shield.png” image. In the end, you should see:

Then create an object group called “Powerups”.

Animating the player

We are using animations to change the player's sprite when the player collides with PowerupShield. Open the player's properties panel and enter “PlayerIdle” in Animation#0. Then add a new animation called “PlayerShield”, and select “player_shield.png” from the assets folder.

Giving extra health to the player

We are ready to open “Events” page. We will add a new condition to check the collision between the Player and the PowerupHealth objects. If the collision happens, we want to increase the player's health by 30 and delete the powerup object since we do not need it anymore.

You can add a comment to classify your events.

Now, we are going you use a new scene variable for the shield object. Create a new scene variable called “PowerupShield” to prevent getting any damage while using this powerup. Enter 0 as a default value.

Go to the “IsDamaged” condition and add a new condition to check if the PowerupShield variable is equal to 0.

Create a new condition for detecting the collision between the Player and the PowerupShield objects. Then, e

Testing out

Before testing out the meteors, we should put some meteor objects on the scene. Drag and drop some meteor items on the scene.

Run the game. Now you can see the meteors on the scene. If you hit some meteors, you will get damage.