Tech+Squad+Day+1+-+2011

We will be introducing the students to game making software, called, Game Maker. You can find the link to Game Maker on the home page of this wiki.

The students will learn about this software, what it can do, as well as what they can expect to learn. We will be teaching the students how to make their own game as described in the following tutorial, as we will explain more in depth during the club.

The following is an excerpt from the Game Maker manual:

Let us look at an example It is good first to have a look at how to make a very simple example. We assume here that you run //Game Maker// in simple mode. The first step is to describe the game we want to make. (You should always do this first; it will save you a lot of work later.) The game will be very simple: There is a blue ball bouncing around between some red walls. The player should try to click on the ball with the mouse. Each time he succeeds he gets a point. As can be seen, we will require two different objects: the ball and the wall. We will also need two different sprites: one for the wall object and one for the ball object. Finally, we want to hear some sound when we succeed in clicking on the ball with the mouse. We will just use one room in which the game takes place. (If you don't want to make the game yourself you can load it from the folder under the name .) Let us first make the sprites. From the **Resources** menu select **Create Sprite** (you can also use the appropriate button on the toolbar). A form will open. In the **Name** field type “wall”. Select the **Load Sprite** button and choose an appropriate image. That is all, and you can close the form. In the same way, create a ball sprite. Next, we make the sound. From the **Resoources** menu select **Create Sound**. A different form opens. Give the sound a name and choose **Load Sound**. Pick something appropriate and check whether it is indeed a nice sound by pressing the play button. If you are satisfied, close the form. The next step is to create the two objects. Let us first make the wall object. Again from the **Resources** menu choose **Create Object**. A form will open that looks quite a bit more complex than the ones we have seen so far. At the left there is some global information about the object. Give the object an appropriate name, and from the drop down menu pick the correct wall sprite. Because a wall is solid, you should check the box labeled**Solid**. That is all for the moment. Again create a new object, name it ball, and give it the ball sprite. We don't make the ball solid. For the ball, we need to define some behavior. In the middle you see an empty list of events. Below it there is a button labeled **Add Event**. Press it and you will see all possible events. Select the **Create** event. This is now added to the list of events. At the far right you see all the possible actions in a number of groups. From the **move** group choose the action with the 8 red arrows and drag it to the action list in the middle. This action will make the object move in a particular direction. Once you drop it in the action list, a dialog pops up in which you can indicate the direction of motion. Select all 8 arrows to choose a random direction. You can leave the speed as 8. Now close the dialog. So now the ball will start moving at the moment it is created. Secondly, we have to define what should happen in the case of a collision event with the wall. Again, press **Add Event**. Click on the button for collision events and in the drop down menu select the wall object. For this event we need the bounce action. (You can see what each action does by holding the mouse cursor still above it.) Finally, we need to define what to do when the user presses the left mouse button on the ball. Add the corresponding event and select the left mouse button from the pop-up menu. For this event we need a few actions: one to play a sound (can be found in the group of **main1** actions) and one to change the score (in the group **score**) and two more to let the ball jump to a new random position and moving in a new direction (in the same way as in the creation event). For the sound action, select the correct sound. For the score action, type in a value of 1 and check the **Relative** box. This means that 1 is added to the current score. (If you make a mistake you can double click the action to change its settings.) Our objects are now ready. What remains is to define the room. Create a new room in the game, again from the **Resources** menu. At the right you see the empty room. At the left you find some tabs, one for setting the background, one for setting some global properties like the width and height of the room, and one where you can add instances to the room. At the bottom you can select an object in the pop-up menu. By clicking in the room you can place instances of that object there. You can remove instances using the right mouse button. Create a nice boundary around the room using the wall object. Finally, place 1 or 2 ball objects in the room. Our game is ready. Now it is time to test our game. Press the **Run** button (the green triangle on the button bar at the top of the window) and see what happens. If you made no mistakes, the ball starts moving around. Try clicking on it with the mouse and see what happens. You can stop the game by pressing the  key. You can now make further changes. Congratulations. You made your first little game!

__**Here is a simplified version:**__
Create two new Sprites from the Resources menu:



Name the first sprite "wall". Then click on the "Load Sprite" button and load an appropriate image.

Name the second sprite "ball". As before, click on "Load Sprite" and select an image.



Next create a sound, by clicking on Create Sound from the resources menu.



Name the sound file, and load a short sound clip.

Next we are going to create the two objects. One for each of the sprites we previously created. From the resources menu, click on Create Object. Name the first object "wall", and then select the sprite we previously created. Click on the "Solid" checkbox to make the wall object solid.



Now we are going to create an object for the ball in the same manner. Click on Create Object again from the resource menu. Name it "ball", and select the ball sprite we have created before.



Next we are going to create events so our ball can react in our game. Click on the "Add Event" button and click on the "Create" event. This will allow us to have the ball to do a specified action on creation. On the right side, move the red multi-arrow button (move-fixed) and drag it to the Actions box on the right side.

After the dialog box above opens, select all of the arrows and set the speed to 8. This will now make the ball move in a random direction upon creation.

We now need to set the ball's bouncing properties against the wall object we made. Click on Add Event, click on collision, and select the wall. On the right, drag the bounce action over. Now our ball will bounce against the walls we will later create.

Now we are going to create a sound, score counter, and a moving action, after a user click on our ball.

First. click on the Add Event button and click on Mouse and then Left Button from the sub-dialog. On the right side, click on the main1 tab, and drag the "Play Sound" button onto the actions box. Select the sound object we made previously.

Next we are going to add a counting score. Click on the "Score" tab on the right, and drag the "Set Score" button into the action box. Set the score to 1, and click on the relative box so the score isn't reset to 1 each time the action runs.

Just like before, we are going to make the ball move in a random direction. Again, drag the red arrows to the actions box, select all arrows and set the speed to 8. We can now click OK to finish with this dialog box.

Lastly we are going to create the 'room' in which our game will take place.

From the resource menu, click on Create Room. From here, select the wall object from the bottom, and place walls in a manner so the ball can bounce from wall to wall. A box like shape will be ideal for our wall placement. After we have created our walls, select the ball object and place it anywhere inside our walled area.



Now click run! If you have followed these steps correctly, the ball should start moving on start, and with each successful mouse click on the ball, a sound should play, your score increate, and the ball should change direction.