Making a Shoot Em Up in Gamemaker Part 2

So far you have a dragon which you can move up and down and shoot fireballs at the Demon. Now you are going to create the babydemon object which will randomly shoot at you.

Add an object and choose the babydemon sprite. Rename the object babydemon.

Renaming objects and sprites makes the game easier to make later on.

Now click on Add event. Create.

Drag the Start moving in a direction icon onto the Actions window. Click down the left hand side arrows as above. Set the speed to 10. Now click on Add Event again and choose Other. Then click on Intersect boundary.

Click and drag the Reverse vertical direction button onto the Actions window and click Ok.

Now click OK on the babydemon object.

Now you need to change the Demon object so that it will fire the babydemons. Double click on the demon object

Click on Add Event. Choose Step, then click onto Step.

Click and drag the chance button from the Control tab (the one with the dice on it) onto the Actions window. Then set the sides to 10 and click Ok. Now click and drag the create instance button from the main1 tab.

Choose the babydemon object and tick the relative box.

Click OK on the Demon object.

Now run and test your game!

Now we need to set some collisions which will allow the fireballs to shoot the babydemons.

Double click on the fireball object. Click on Add event – choose collision and select the baby demon.

Now click on the main1 tab and click and drag the destroy instance button onto the actions tab.

Choose other and click ok.

This will delete the babydemon object that the fireball collides with.

Now click and drag another destroy the instance button and choose self. This will delete the fireball object once it hits a babydemon. Now click onto the score tab. Drag the set score button onto the actions tab. Set the new score to 1 and tick the relative box. This will mean the score will increase by 1 each time.

Now run and test the game again. You should be able to shoot the babydemons and get a score!

The game still isn’t finished as you now have to set a collision between a babydemon and the dragon.

Double click on the babydemon object.

Click on Add Event, choose collision and select the dragon object.

Now click onto main2 tab. Click and drag the display message button and type in a message. Click ok. Now click on the score tab and click and drag the high score table. Click ok.

Now finally click on the main2 tab and click and drag the restart game button.

Click OK on the object. Run and test the game!

Now you will add a health bar to the dragon. This is a bit tricky so read the following very carefully.

Add an object. Don’t choose a sprite for it.

Name the object healthbar, Click on Add event and choose draw. Then drag the draw health bar button from the score tab onto the actions pane. Set the settings for the health bar as above. Now double click on the room.

Choose the health bar object and place it in the top corner of the grid.

Run and test the game.

The health bar should show up in the top corner.

Now you need to program the health bar to decrease when you collide with a babydemon and finish the game when it has run out.

Double click the dragon object.

Click on Add Event then Create. The on the score tab click and drag set the health button onto the actions pane and set the health to 100.

Click OK on the dragon object properties.

Now double click on the babydemon object See if you can add the following. The Destroy instance action is to destroy self (it deletes the babydemon that has collided with the dragon).

Run and test your game.