Time for action — throwing grenades
We're now ready to add a grenade object into our game for the players to use in their quest to destroy the robot factory.
1. Draw up a grenade object image to use in the game that resembles the one shown in the following image:
2. Add a sprite to the
Objects
layer of our game. Give this sprite the nameGrenade
and paste the image into it.3. Give the
Grenade
object thePhysics
behavior and the settings shown in the following screenshot:4. Give the object the
Timer
behavior to add countdown timers to the object as needed with events.5. Check the attribute Destroy on Startup before finally setting the
Collisions
mode toBounding box
.6. Create two more
Global Variables, P1Grenades
, andP2Grenades
respectively.7. We can now go into the Event Sheet Editor for the
Game
event sheet to create the events to controlGrenades
.8. In our
Start of layout
event, add actions to set the variablesP1Grenades
andP2Grenades
to3
.9. Create an event group
Grenades
with a...