Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gdevelop5:tutorials:space-shooter:8-powerups [2020/11/24 15:31]
dkarakay
gdevelop5:tutorials:space-shooter:8-powerups [2021/02/14 23:09] (current)
mannhb [Testing out]
Line 12: Line 12:
 6. [[gdevelop5:tutorials:space-shooter:6-enemy-mechanics|Space Shooter, Part 6]] 6. [[gdevelop5:tutorials:space-shooter:6-enemy-mechanics|Space Shooter, Part 6]]
 7. [[gdevelop5:tutorials:space-shooter:7-meteors|Space Shooter, Part 7]] 7. [[gdevelop5:tutorials:space-shooter:7-meteors|Space Shooter, Part 7]]
-7. [[gdevelop5:tutorials:space-shooter:8-powerups|Space Shooter, Part 8]]+8. [[gdevelop5:tutorials:space-shooter:8-powerups|Space Shooter, Part 8]] 
 +9. [[gdevelop5:tutorials:space-shooter:9-ui|Space Shooter, Part 9]] 
 +10. [[gdevelop5:tutorials:space-shooter:10-sound-effects-music|Space Shooter, Part 10]] 
 +11. [[gdevelop5:tutorials:space-shooter:11-visual-effects|Space Shooter, Part 11]] 
 +12. [[gdevelop5:tutorials:space-shooter:12-levels|Space Shooter, Part 12]] 
 +13. [[gdevelop5:tutorials:space-shooter:13-main-menu|Space Shooter, Part 13]]
  
 <note tip> In this chapter, we will learn how to add two different powerups to the game. </note> <note tip> In this chapter, we will learn how to add two different powerups to the game. </note>
Line 18: Line 23:
 ## Adding 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:+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:
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-adding-powerup-objects.png?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-adding-powerup-objects.png?nolink |}}
  
-Then create an object group called **"Powerups"**.+Then create an object group called **"Powerups."**
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-adding-powerup-group.png?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-adding-powerup-group.png?nolink |}}
Line 28: Line 33:
 ## Animating the player ## 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.+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.
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-player-animation-min.gif?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-player-animation-min.gif?nolink |}}
Line 34: Line 39:
 ## Giving extra health to the player ## 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.+We are ready to open the **"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.
  
 <note tip> You can add a comment to classify your events.</note> <note tip> You can add a comment to classify your events.</note>
Line 46: Line 51:
 Go to the **"IsDamaged"** condition and add a new condition to check if the **PowerupShield** variable is **equal to 0**.  Go to the **"IsDamaged"** condition and add a new condition to check if the **PowerupShield** variable is **equal to 0**. 
  
-<note tip> We are going to use this condition to prevent getting damaged while using the powerup</note>+<note tip> We are going to use this condition to prevent getting damaged while using the powerup.</note>
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-scale-powerups-min.gif?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-scale-powerups-min.gif?nolink |}}
Line 68: Line 73:
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-add-powerup-timer.png?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-add-powerup-timer.png?nolink |}}
  
-Finally, we are going to set "**PowerupShield"** and **"IsDamaged"** variables to **0** and **change the animation** of the player to **"PlayerIdle"**We also need to reset the timer called **"PowerupShield"**In the end, your events should look like this:+Finally, we are going to set "**PowerupShield"** and **"IsDamaged"** variables to **0** and **change the animation** of the player to **"PlayerIdle."** We also need to reset the timer called **"PowerupShield."** In the end, your events should look like this:
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-chapter-8-events.png?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-chapter-8-events.png?nolink |}}
Line 74: Line 79:
 ## Testing out ## Testing out
  
-Before testing out our powerups, we should change the scale of powerup objects just like in the previous cases. Select **Powerups object group** and set scale factor to **1.5**:+Before testing powerups, we should change the scale of powerup objects just like in the previous cases. Select **Powerups object group** and set scale factor to **1.5**:
  
 {{ :gdevelop5:tutorials:space-shooter:space-shooter-scale-powerups.png?nolink |}} {{ :gdevelop5:tutorials:space-shooter:space-shooter-scale-powerups.png?nolink |}}