Assignment 1

 

 

 

 

 

In the game we will create, some pieces of fruit and move them around. The player must click on the fruit with the mouse to collect them. For each fruit collected, points are scored. Fast moving fruits give more points than slow fruits. And there are bombs around that you should avoid. The game will look as follows:

 

 

 

 

Adding Sprites

 

Our game needs images for the walls, the fruits, and the ghosts. Such images are called sprites in Game Maker. So the first step is to add some sprites.

 

To add a sprite click on the button with the Pacman symbol:

 

 

Press the button Load Sprite.

 

Open the K:Drive folder Gamemaker Sprites > Tutorial1 and in there double click on the image wall.png.

 

Give the sprite an appropriate name, e.g. spr_wall.
All sprite names must begin with spr_

 

 

 

Now press the OK button to close the form. In the same way add sprites for the apple, banana, bomb, cherry, and strawberry and give them appropriate names.

 

 

In your A1-FruitGame folder save the Game as "FruitMania"

 

Note that the file will get the extension .gmk.
All files created with Game Maker will have that extension.

 

 

 

Creating Objects

 

Sprites are just images. They don't do anything. But objects in your game must perform actions. They move around, react to mouse clicks, etc. So the next step is to create some objects. We will start with the wall object. To add an object click on the Blue Ball button.

 

 

Name the object, obj_wall and add set the sprite to spr_wall

 

 

The wall object must be solid because we do not want the fruit to move through it so check Solid. The wall needs no further behavior, so press the OK button to close the form. The wall object should now have appeared in the list at the left. Better save your work before continuing.

 

 

The Apple Object

Now create the apple object, name it obj_apple and select the apple sprite for it. The apple is not solid. So the form should look as follows:

 

 

 

 

Our first step is to make sure the apple starts moving when it is created. Press the button Add Event and select the Create event:

 

 

 

Set the direction and the speed.

 

 

Next we must make sure it bounces against the walls.

Add a Collision Event with obj_wall

 

 

Now click the bounce action (the bottom right one) and drag it into the action list. In the form that appears simply press the OK button.

 

 

Our final step is to make sure the player can press the mouse on the apple. When this happens modify the score and move the apple.

 

Add Event > Mouse > Left pressed.

 

 

Drag the Jump to Random action to the list.

 

 

 

Drag the Set Score action to the list.

 

Set the Score to 50 and check Relative (Relative adds to the existing score)

 

 

 

 

 

 

Press OK to close the object form.

 

Creating a Room

Name the room

rm_level1

Design your room and add a few apples

 

Testing the Game

Now it is time to test the game. Save the game First.

Press the green run button in the toolbar.

 

 

If you followed the previous steps correctly the Game Maker window disappears and a window shows in which the apples move around. If they hit the wall they should bounce back. And if you manage to click with your mouse on one of the apples, you should see the score in the window caption increase and the apple jumps somewhere else.

 

 

Better check the game carefully. Do the apples move in different directions? If not you probably did not create the correct Create event. Do they bounce of the walls? If not, you probably either did not make the walls solid or you did not create the correct Collision event. Can you click on them with the mouse and do you get some additional score? If not you must have made an error in the Mouse press event.

You can switch the game to fullscreen mode by pressing F4. Press Esc to end the game and return the Game Maker.

 

 

 

 

Adding a Background

 

 

 

Find a background on the internet and save it to your K:Drive > A1 Folder

 

Give ive the background an appropriate name and press the Load Background button and load a background of your choice.

 

 

The next step is to make the background visible in the room we already created.

 

 

In the form, click on the tab backgrounds to open that page.

 

 

In the middle click on the menu icon, next to where it says <no background> and select the wooden background. The background should now be visibile in the room at the right.

 

 

 

 

Adding a Sound

Next we add a sound effect to the game. This effect must play when the player clicks on an apple. Cllick on the button with the image of a speaker:

 

 

In the form that appears, give the sound an appropriate name and press the Load Sound button.

 

 

 

Choose your sound file and press OK to close the form.

 

 

 On Left Pressed of obj_apple ad the sound

 

 

 

 

Again press OK to close the object form. Save and play the game, and now the sound should play whenever you click on an apple.

 

 

Adding Music

 

Create obj_PlayMusic, it will not have a sprite

On the Create event add the Play Sound action. As a sound select the music and set loop to true. So the music will now play forever after the object is created.

 

 

Add the Object to the room. It will appear as a ? but will not show in the game.

 

 

Be careful to only add one instance of the music object. Press the green checkbox to close the room form. Save the game and run it. You should now hear background music.

 

 


More Fruit

Banana

 

Duplicate the obj_apple and change the name to obj_banana

 

Modify the speed, direction, points received. Make the banana harder to click and give it more points.

 

In the same way add an object for the cherry and for the strawberry. You can give them different speeds and corresponding higher or lower scores.

 

 

Now reopen the room (double click on it in the list) and add a few instances of the different fruits. You might need to remove some apples to make room. Remember that you can use the right mouse button to remove instances.

Save and play the game. Test it all carefully. Make sure that you indeed get a score that corresponds with the difficulty of the fruit.

 

Adding a Single Bombs

Although the game can already be fun to play, there is something missing. You cannot lose! You can just keep clicking randomly, which is not really much fun. So, we are going to add bombs to the game.

If you click on a bomb you will lose and the game will end. Bombs won't move, but their number keeps increasing to make the game more and more difficult over time.

 

We want the bomb to appear in a random place. Add the Create event. In it place the action to jump to a random location.

Add a sound to the bomb on left mouse click

 

Ending the Game

 

When the user clicks on the bomb we want the game to end.

We want to wait a little while to let the player realize he lost. From the main2 tab, drag the sleep action (with the zzz on it) and place it below the play sound action. The default values are fine, so press OK.

As a next step we want to show a highscore list. This is very easy in Game Maker. From the score tab, drag the show highscore action (with the 1,2,3 in it). In the form you can set quite some values. As a background you can choose the wood background. You also can change the colors and the font if you like.

 

 

As a final step we need the action to restart the game, which can be found in the main2 tab. The action list should now look as follows:

 

 

Make sure the order of the actions is correct. (If not, drag them to the correct location.) That finishes the bomb object so better press the OK button to close the form. To test the game, place one or two bomb objects in the room. Save the game, run it, catch some fruit and then click on a bomb. An explosion sound should be heard and the highscore list should show. Note that in this list you can add your name if you get a new high score.

 

 

Spawning Multiple Bombs

To make the game more difficult we want to create additional bombs while playing the game. Create a new object (obj_spawnbombs) without a sprite. (Don't forget to add it to the room)

 

To create the bombs we will use alarm clocks. You can set these clocks to a particular value and they will then tick down to 0. Once they reach 0 an Alarm event will happen.

 

To initialize the alarm clock, go to then main2 tab and drag the alarm (with the clock image) to the action list. As a number of steps indicate a value of 60. Note: A second is 30 steps so we will add a new bomb every 2 seconds.

 

 

 

 

Now Add an Alarm event and select in the menu Alarm 0. In this event we will create the bomb. Go to the main1 tab and drag the create instance action (the lightbulb) and select the bomb object as what you want to create.

 

 

 

 

There is no need to set a position as the bomb will anyway jump to a random position.

 

Next we must start the alarm clock again . So add the alarm action (from the main2 tab) and set alarm 0 again to 60. . So the action list now looks as follows:

 

 

Close the object form, save the game, and run it. You should see more and more bombs appearing and eventually you will click on one of them and the game will end. If you want to make the game a bit harder, you can also let the bombs move slowly. You should by now know how to achieve that.

 

 

 

 

 

Giving Help

Even though you know how to play the game, somebody else might not. So you should provide some help for the player. This is very easy in Game Maker. Double click on the Game Information at the bottom of the list at the left.

 

 

A simple editor will appear. Here you can type a little help text. Give your game a name and describe what the goal is. You can choose different fonts, colors, and styles. Once you are ready, press the green checkmark at the top left to close the form.

Now when you run the game and press F1, the help text will appear. Escape will return you to the game


 

Adding Lives to your Game

When using something like lives in a game, you have to track it using variables.  There are several built in variables in GameMaker including score, lives and health.

Create a new object and call it, obj_setvariables

This object will set how many lives you start with, the same object can be used to set other variables such as score, coins etc.


In GameMaker, there are actions to set, check and draw the lives, health and score variables. These variables are global variables (valid in any room) , it's up to you to set and use them.

Here are the actions used to set, check and draw the lives on the screen.

Action Lives Set Action Lives Check Action Lives Draw Image Action Lives Draw Image

Setting the Lives at the Start of the Game

Add a Create event to the obj_setvariablse object, on this event, you will set your lives and health etc.


  Event Create

From the Score tab, drag in the Set Lives Action Action Lives Set

Set the New Lives as, 3

You MUST put this obj_setvariables object in your first room, if you don't, the lives won't be set when the game starts. You can also put this object in your game over screen to reset the lives and score for when the player continues the game. Every time you go to a room with this object in, it will reset the lives and anything else you set on it so be careful where you use it.

Doing this will set the Lives as 3 when the game is started.

Losing a Life when you Click a Bomb

Now we want to change the game up so when you click a bomb, you lose a life. (instead of dying right away)

Add the Set Lives Action Action Lives Set


Set the New Lives as, -1 and tick relative, this will take away one life from your total.

Add the No More Lives Event from the Other Events Group Event Other

In this event, put what actions you want to happen when the character runs out of lives.

Add the object to your Level 1

  

Drawing the Lives on the Screen

Now the game has lives, the next thing we need to do is show the user how many they have left. Drawing onto the screen is all done with an object.

Create a new object and call it, obj_displaylives, don't give it a sprite.

Add the Draw Event. This is event is used to draw onto the screen.

Event Draw

There are two actions to draw the lives on to the screen,

Draw the Number of Lives Action Lives Draw Image

This draws the number of lives in text, you can give this a caption if you want.

Example Lives Number

Draw Lives as an Image Action Lives Draw Image

This draws the number of lives as a sprite, sort of like how it's done in Zelda.

Example Lives Image

 

Drag in either one of these Actions from the Score tab.

On the settings menu, put in what position you want to draw the lives at on the screen.

Example Draw Lives as Image Settings

In this example I have put 10x and 10y, this will draw it at the top left of the level.

If you are drawing lives as an image, you have to also select what sprite to use to represent one life.

Now you have to change when the game ends (i.e. When you are out of lives)

 

 

 

Your Turn

1. Create a new room called rm_Intro

Include a graphic, instructions and a Play Game Button.
When the Play Game Button is clicked move to Level 1.

2. Create a Second Level that you enter when your reach a certain score. (Set the score low for testing purposes)

Include different sprites, a different enemy, scoring system etc.

3. Create a "Game Over" Screen and a "You Win" Screen. These should be called before the "High Score" Table

4. Come up with a name for your Game Production Company and Create a "Splash Screen" Video for the start of your Game.

Animated Text

flamingtext.com
cooltext.com

Using Movie Maker
1. Create your video animation using titles, credits, effects and graphics
2. Save Movie as a .wmv file

Make sure the video is in the same folder as your game.

In Gamemaker

1. Create a rm_splash
2. Create obj_playvideo

add the object to the room

Above and Beyond (20%)

Add additional items and at least one additional level to your game. The new level must have different objects and sprites.
You should try something new and think outside of the box to obtain maximum marks.

 

Play your game and record a video of you completing all the levels using Screen Recorder.

 

Upload the following to your Google Drive

.exe file in Folder Everyone
.gm81 file in Folder Gravelle
Assesment Rubric in Folder Gravelle

Submitting your Work

Using the Template post your game and other required elements on your website.

Complete peer evaluations.
For this assignment you will evaluate the 3 people below you on the student list and 1 person of your choice.

Send the evaluations you complete to the programmer. Use google drive and share or email.


Add the evaluations you did and the ones your received to your website.



 

 

 

 

 

 

 

.