Breakout
1 Setting Up The Bat

Section Menu

Breakout Home | 1 | 2 | 3 | 4 | 5 | 6

Launch Gamemaker and immediately create a saved file called Breakout.

Click with the Right Mouse Button on Rooms and choose to Create Room. The room is where all of the game action takes place.

Now we are going to add the graphic we want to use as a bat in the game. Click with the right mouse button on Sprites and choose to Insert Sprite. Name the sprite, spr_bat and click on the Load Sprite button. Choose a bat image from the graphics supplied.

Game Maker Screenshot

Sprites don't appear in the game unless they are used in an object. Click with the right mouse button on Objects. Choose to create an object called obj_bat. Select the bat sprite as the image to use and make sure that you have clicked on the checkbox that makes the object solid.

Game Maker Screenshot

Make sure that the room window is open. The Objects tab should be visible in the left of the window. The bat object should be selected in the box at the bottom. Click with the left mouse button to place your bat as shown in the screenshot.

Game Maker Screenshot

In order to make the bat move, we need to play around with the bat object. Double click on the bat object to bring up the bat window. Click on Add Event and choose Step. Drag the first Jump icon into the Actions window and fill in the pop-up as shown.

Game Maker Screenshot

This gives you,

Game Maker Screenshot

The x co-ordinate of the bat will be changed to match the position of the mouse. 32 is added to this value so that the centre of the bat is moved to that point.

The y co-ordinate shouldn't change (the bat cannot move up and down) so the value y is added here.

Save your work and press the green play button on the toolbar to run your game for the first time.

Move the bat around and enjoy the experience.

Some Sorting

The cursor is visible and distracts a little from the moving bat graphic. We can sort this out easily by click on Global Game Settings on the left. Uncheck the cursor box to stop the cursor displaying during the game.

⇐ Previous | Next ⇒