Creating a top down shooter game

In this tutorial you will create a simple top down shooter game.

You will learn:

  • how to create a player, an enemy and bullets

  • how to make the player to move with directional keys

  • how to make the player shoot bullets with the mouse

To start creating your game, access the URL below: https://www.easygamemaker.com/create

Select the "Object Types" tab.

Click in the button "Add Custom Object Type".

A new object type will be created. Click "edit".

On the field "id", type a name for the object type (for example "player").

Then, click the button "Change image".

Select an image for your object type.

Click in the button "save changes".

Now, let's create another object type, for the enemy.

Click again in the button "Add Custom Object Type".

Repeat the process to create a new object type. This time, set the id to "enemy", set the width and height to 60, change the image and then click "save changes".

Finally, create an object type for the bullet. Set the id to "bullet", set the width and height to 10, select an image for the bullet and then click "save changes".

You should see the 3 object types that you created.

Now let's configure the movement of the player. We want our player to move in the 4 directions, controlled by the directional keys of the keyboard.

To configure that, click to "edit" the player.

Select the tab "Behaviours", click the button "Add behaviour", and then click "edit".

Fill the fields acording to below:

On the field "type" select "KEYBOARD_MOVEMENT". On the field "keyboardMovementType" select "SET-SPEED_ON_KEY_DOWN". On the fields "speedX" and "speedY", type "3".

Then click "save changes".

Now the movement of the player is configured. Click the "Back" button.

Now that we created the object types, let's add them to the scene.

Click on the "Levels" tab, and then click the "Level 1".

Click the button "Add object".

The player is now in the center of the level.

Now, we will add the enemy. Click again in the "Add object" button, to add another object. Then click "edit" on the second object.

Change the type to "enemy". Also, let's change the position of our enemy. Set x to 500 and y to 300. Then, click "save changes".

Now we can see the player and the enemy in the screen.

Now, let's test our game. Click the "Back" button and then click the "Play" button.

You should be able to control the player with the directional keys of the keyboard. You will see also the enemy, stopped.

The next step now is to allow our player to shoot, with the mouse. When you click the mouse button, the player will shoot the bullet in the direction of the mouse pointer.

Click "Edit game" to go back editing our game.

Select the "Events" tab, and click button "Add event".

Click "Add event condition".

Click on the "edit" link.

On the field "type", select "MOUSEDOWN" and click "save changes".

Click "Add event action", and then click "edit".

Fill all the fields according image below and click "save changes".

Category: OBJECT Type: SHOOT_OBJECT CustomObjectTypeId: bullet SourceType: OBJECT SourceObjectSelectorType: All objects of type... CustomObjectTypeId: player TargetType: MOUSE_POSITION Speed: 10

Now, let's test our game again. Click the button "Play Game".

The player now will be able to shoot bullets, using the mouse.

You finished this tutorial.

In the next tutorial you will learn:

  • how to test collision between objects

  • how to subtract life from enemies when they are hit by a bullet

  • how to make enemies follow the player

Last updated