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:geometry-monster:9-adding-bombs [2019/11/28 17:09]
end3r navigation
gdevelop5:tutorials:geometry-monster:9-adding-bombs [2019/12/09 21:17] (current)
bouh
Line 6: Line 6:
 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**! 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**!
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​122.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​122.png?direct|}}
  
 Click to "Add a new object"​... Click to "Add a new object"​...
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​123.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​123.png?direct|}}
  
 ...and select the "​Sprite"​. ...and select the "​Sprite"​.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​124.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​124.png?direct|}}
  
 "​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. "​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:​125.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​125.png?direct|}}
  
 Add another comment, and call it "​Obstacle"​. Add another comment, and call it "​Obstacle"​.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​127.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​127.png?direct|}}
  
-Add new condition, ​select the "​Obstacle"​ and search the "Other conditions"​.+Add new condition, search the "Other conditions"​.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​128.png |}}+{{ :​gdevelop5:​tutorials:​geometry-monster:​128.png?direct|}}
  
-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 name" as "​ObstacleCreation"​.+Within "​Timers and time", select "Value of a scene timer"​. In the right panel, enter "Time in seconds"​ which will be `5`, and "​Timer'​s name" as "​ObstacleCreation"​.
  
 This will create a new timer that will spawn a bomb independently from spawning the shapes, and it will appear once every 5 seconds. This will create a new timer that will spawn a bomb independently from spawning the shapes, and it will appear once every 5 seconds.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​129.png |}}+<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 challenging. You 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>​ 
 + 
 +{{ :​gdevelop5:​tutorials:​geometry-monster:​129.png?direct|}}
  
 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. 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.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​131.png |}}+{{ :​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. 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 |}}+{{ :​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.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​133.png |}}+{{ :​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 `100` into the "​Speed"​. Remember about having the "​Obstacle"​ selected, then look for "Add a force (angle)",​ enter `90` into the "​Angle"​ field, and `100` into the "​Speed"​.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​134.png |}}+{{ :​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`.
  
-{{ :​gdevelop5:​tutorials:​geometry-monster:​135.png |}}+{{ :​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.