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

9. Adding 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!

Click to “Add a new object”…

…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.

Add another comment, and call it “Obstacle”.

Add new condition, select the “Obstacle” and 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 name” as “ObstacleCreation”.

This will create a new timer that will spawn a bomb independently from spawning the shapes, and it will appear randomly once every 10 to 20 seconds.

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.

The second action to add is “Start (or reset) a scene timer” in “Timers and time”, and then “ObstacleCreation” as the name.

It should look like this above after you successfully complete the steps. If it is, add another action.

Remember about having the “Obstacle” selected, then look for “Add a force (angle)”, enter 90 into the “Angle” field, and 200 into the “Speed”.

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.

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.