Catch The Clown
2 Adding Movement
Now to turn our work into a game by adding interaction to the clown object.
Making The Clown Move
Actions in Gamemaker take place after certain events.
- Double click on the Clown Object to open up the clown object window.
- Click on the Add Event button and add a Create Event. When the clown first appears on the screen we want to start it moving in a random direction.
- Drag the Move Fixed icon into the Actions window. Fill in the window as shown.
Your clown object window should now look like this,
Making The Clown Bounce Off The Walls
When the clown hits a wall, we want it to bounce off and start moving in another direction. When two objects are touching in the game, we say that there is a Collision.
- Click on the Add Event button and add a Collision Event with the wall object.
- Drag in the Bounce icon and click OK on the window that pops up.
Save your work and press F5 to test the game so far. The clown should move around the screen, bouncing off the walls when he hits them. If that doesn't happen, read through the last 2 pages and see if you can spot your mistake before asking for help.