Differences

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

Link to this comparison view

Next revision
Previous revision
gdevelop5:tutorials:geometry-monster:9-adding-bombs [2019/11/21 16:19]
end3r created
gdevelop5:tutorials:geometry-monster:9-adding-bombs [2019/12/09 21:17] (current)
bouh
Line 1: Line 1:
-9Adding bombs+⬅️ **[[gdevelop5:​tutorials:​geometry-monster:​8-tracking-score|Previous part: 8Tracking the score]]** ​   
 +➡️ **[[gdevelop5:​tutorials:​geometry-monster:​10-more-lives|Next part: 10. More lives]]**
  
-It's great to have the core mechanic of collecting the shapes in place, but it gets boring quite quickly, and it's way too easyWhat if we could increase the difficulty level by introducing objects that you shouldn'​t collect? Behold: ​bombs!+====== 9Adding ​bombs ======
  
-IMG 122+It's great to have the core mechanic of collecting the shapes in place, but it gets boring quite quickly, and it's way too easy. What if we could increase the difficulty level by introducing objects that you shouldn'​t collect? Behold: **bombs**!
  
-Click to Add a new object...+{{ :​gdevelop5:​tutorials:​geometry-monster:​122.png?​direct|}}
  
-IMG 123+Click to "Add a new object"​...
  
-...and select the Sprite.+{{ :​gdevelop5:​tutorials:​geometry-monster:​123.png?​direct|}}
  
-IMG 124+...and select the "​Sprite"​.
  
-Object'​s name will be Obstacle, same goes for the name of the animation. We have two frames of the animation to show, and it will last for 0,1 seconds, looped.+{{ :​gdevelop5:​tutorials:​geometry-monster:​124.png?​direct|}}
  
-IMG 125+"​Object'​s name" will be "​Obstacle",​ same goes for the name of the animation. We have two frames of the animation to show, and it will last for `0,1` seconds, looped.
  
-Add another comment, and call it Obstacle.+{{ :​gdevelop5:​tutorials:​geometry-monster:​125.png?​direct|}}
  
-IMG 127+Add another comment, and call it "​Obstacle"​.
  
-Add new condition, select the Obstacle and search the Other conditions.+{{ :​gdevelop5:​tutorials:​geometry-monster:​127.png?​direct|}}
  
-IMG 128+Add new condition, search the "Other conditions"​.
  
-Within Timers and time, select Value of a scene timer. In the right panel, enter Time in seconds which will be RandomInRange(10,​20),​ and Timer'​s nameObstacleCreation.+{{ :​gdevelop5:​tutorials:​geometry-monster:128.png?​direct|}}
  
-This will create ​new timer that will spawn a bomb independently from spawning ​the shapesand it will appear randomly once every 10 to 20 seconds.+Within "​Timers and time", select "Value of scene timer". In the right panelenter "Time in seconds" which will be `5`, and "​Timer'​s name" as "​ObstacleCreation"​.
  
-IMG 129+This will create a new timer that will spawn a bomb independently from spawning the shapes, and it will appear once every 5 seconds.
  
-Now the action - select ​the Obstacle, search for Create an object, and set the X position to RandomInRange(80,​ 640-80), and Y to -100It'​s ​the exact same approach as with shapes.+<note tip>Feel free to change this value to make the game harder. We'll see in a next chapter how to speed up bombs as the time is passing ​- to make the game more challengingYou could also use a variable instead of a number, so that you can change during ​the game the time between the creation of bombs!</​note>​
  
-IMG 131+{{ :​gdevelop5:​tutorials:​geometry-monster:​129.png?​direct|}}
  
-The second ​action to add is Start (or reseta scene timer in Timers and time, and then ObstacleCreation as the name.+Now the action ​- select the "​Obstacle",​ search for "​Create an object",​ and set the "X position" ​to `RandomInRange(80, 640-80)`, and "Y position"​ to `-100`. It'​s ​the exact same approach as with shapes.
  
-IMG 132+{{ :​gdevelop5:​tutorials:​geometry-monster:​131.png?​direct|}} 
 + 
 +The second action to add is "Start (or reset) a scene timer" in "​Timers and time", and then "​ObstacleCreation"​ as the name. 
 + 
 +{{ :​gdevelop5:​tutorials:​geometry-monster:​132.png?​direct|}}
  
 It should look like this above after you successfully complete the steps. If it is, add another action. It should look like this above after you successfully complete the steps. If it is, add another action.
  
-IMG 133+{{ :​gdevelop5:​tutorials:​geometry-monster:​133.png?​direct|}}
  
-Remember about having the Obstacle selected, then look for Add a force (angle), enter 90 into the Angle field, and 200 into the Speed.+Remember about having the "Obstacle" ​selected, then look for "Add a force (angle)", enter `90into the "Angle" ​field, and `100` into the "Speed".
  
-IMG 134+{{ :​gdevelop5:​tutorials:​geometry-monster:​134.png?​direct|}}
  
-We'll make sure the bomb is in front of the shapes, and not behind them - to do that, we're gonna use Z order. It's a way to tell the game how we want the objects to be rendered. Obstacle, then Z order, then = (set to) and 4.+We'll make sure the bomb is in front of the shapes, and not behind them - to do that, we're gonna use __Z order__. It's a way to tell the game how we want the objects to be rendered. ​"Obstacle", then "Z order", then `= (set to)and `4`.
  
-IMG 135+{{ :​gdevelop5:​tutorials:​geometry-monster:​135.png?​direct|}}
  
 Launch the game and see the shapes falling down the screen, with bombs appearing once every few shapes and falling independently. Colleting shapes give you points, while bombs do nothing yet. Launch the game and see the shapes falling down the screen, with bombs appearing once every few shapes and falling independently. Colleting shapes give you points, while bombs do nothing yet.
  
-Bombs are challenging,​ so let's make the gameplay a little bit easier by introducing lives.+Bombs are challenging,​ so let's make the gameplay a little bit easier by introducing ​[[gdevelop5:​tutorials:​geometry-monster:​10-more-lives|lives]]. 
 + 
 +⬅️ **[[gdevelop5:​tutorials:​geometry-monster:​8-tracking-score|Previous part: 8. Tracking the score]]** ​   
 +➡️ **[[gdevelop5:​tutorials:​geometry-monster:​10-more-lives|Next part: 10. More lives]]**