Open GameMaker and then go to File > Open. Then click on Home > GameMaker …


Then double-click on the Click It file. Double-click on the Objects folder to see these objects …


Wall
Double-click on the wall object to go into. Check the box to make it solid. Then click on OK to close it. No events/actions for this; they just sit in the room.


Balls Moving
Go into the ball object.

Add a new event: Create (what happens when the room loads)…

Drag the Move Fixed action into the Actions area and let go…

In the action window that opens up:
- click on all the arrows (but not center square) so the ball will move in all directions
- set the speed 8

So now your ball object looks like this so far…

Balls Bouncing Off Walls
We need the balls to stay in the room so you need to add another event: Collision with wall

First add a Bounce action…

Click OK to keep default settings (set to solid objects, so it’ll bounce off the wall object which is solid but not other balls).

Your Collision with wall event looks like this…

You can say OK to the ball object to close it for now.
Testing the game
Always save your game before testing it out (when it’s saved there will be no * by the file name).

Then click on the green arrow to run the game.

GM creates another copy of your game in play mode that is a plain red ball.

Make sure everything is working so far:
- Do the balls move on their own?
- Do the balls stay inside the walls?
- Do the balls move randomly?
To close it, hit the Esc key.
Score
Go back into the ball object and add the Left button event (under Mouse events)…

Add action Set Score …

In the window that opens up, check the box for relative (so it keeps going up) and the amount to 10 so the player gets 10 points each time they click on a ball.

Now add the action Jump to Random position (default settings). This is so that each time the player clicks on a ball, it starts over in a new random place (otherwise the game would be too easy, you could just hold down the mouse on a ball and have your score rack up!)

Your Left button event should look like this…

Save and test your game (F5) and click on some balls.

As you click on some balls, you should see the score go up in the caption area of your window.

Bad Guy
Open the badguy object…

Add a Create event with the Move Fixed action… set it so it will move in all directions, speed 8.


Add the Collision with wall event and set it to Bounce off solid objects.

Add the Left Mouse click event…

- Set Score: set to -20 (so the player loses 20 points when they click on the bad guy), make sure it’s relative
- Jump to Random

Save your game/file, then test it out. First click on some balls to make your score go up to at least 50 points, then click on a bad guy to make sure it goes down by 20 points.

Ending the Game
To end the game we need to test when the game would be over, ie when the player reaches a certain score.

Add a Step event (this will continuously check for the action we set next)

We will first test how many points the player has using the Test Score action…

Since this is a simple game and we just want to get the idea, we’ll test if the score is larger than 100.

If it’s true, then you want it to do both of the following actions (so you need to put start and end blocks around it)…

- Display a Message – type in something like “Congratulations”
- End the Game

So your controller object should look like this.

Save your game/file, then test it out.

When you have 100 points and click on the next ball, you should get the pop up window. Keep the pop-up window open as proof you have completed the game!
