0% found this document useful (0 votes)
25 views

Lesson 1 - Create Sprites and Objects

This document provides instructions for creating a basic game in Game Maker that involves creating and moving a dragon sprite. The key steps covered are: 1. Creating sprite assets for the dragon facing different directions. 2. Creating an object for the dragon and assigning it the sprite and movement code. 3. Adding event code to control the dragon's movement and sprite based on arrow key presses. 4. Creating a room with a dark green background and adding the dragon object.

Uploaded by

Roslee Bin Jalie
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Lesson 1 - Create Sprites and Objects

This document provides instructions for creating a basic game in Game Maker that involves creating and moving a dragon sprite. The key steps covered are: 1. Creating sprite assets for the dragon facing different directions. 2. Creating an object for the dragon and assigning it the sprite and movement code. 3. Adding event code to control the dragon's movement and sprite based on arrow key presses. 4. Creating a room with a dark green background and adding the dragon object.

Uploaded by

Roslee Bin Jalie
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

NPGCC Game Maker

Training
Lesson 1 – Creating Sprite and Object
Lesson Objectives
• At the end of this lesson, you will be able to:
1. Create sprites
2. Create objects
What are sprites and objects?
• Sprites are the pictures and animations you use in the game.
• Objects
• The difference between sprites and objects is that:
1. You can add many sprites into one object
2. You can’t assign actions or movements to a sprite but you
can do so on an object.
Creating a new game
• First, launch Game Maker.
• Once Game Maker is launched, make sure your game is in Advanced
Mode by clicking on File > Advanced Mode

Make sure there is a Tick


in Advance Mode here
Saving your game
• Click on File > Save As and save it in the folder
“TrainingforNPGCCGameMaker”.
• Save it with the file name “NPGCC Training Game”
Creating a sprite
• Right click on Sprites on the task bar on the left column.
• Click on Create Sprite
Name the sprite and edit it
• The Sprite Properties window will open.

• On the Name
column, type in
“spr_dragon_right”

• Click on Edit Sprite after


that
Sprite Editor
• The Sprite Editor window will now open.

• Click on File > Create


from Strip
Opening the image
• Select the dragon image in the TrainingForNPGCCGameMaker
folder
Strip Image Properties

• Set the number of


images to 6
• Set the images per
row to 6
• Set the image width
to 76
• Set the image height
to 75
• Click on Ok
Cropping the images
• Make sure the
Show Preview
tickbox is ticked
• Click on Transform
> Crop
Cropping the images and Save Changes
• Make sure the Border size is • Click on the Tick
set to 0.
• Click on Ok. button
Center the Sprite
• Important!
Remember to
click on the
Center button.
• Click on OK
Create more sprites
• Using the same steps given above, create these sprites:
1. spr_dragon_left, with the number of images set to 6, images
per row set to 6, Image width set to 75, image height set to
70, vertical cell offset set to 4
2. spr_dragon_up, with the number of images set to 6, images
per row set to 6, Image width set to 75, image height set to
70, vertical cell offset set to 6
3. spr_dragon_down, with the number of images set to 6,
images per row set to 6, Image width set to 75, image height
set to 71, vertical cell offset set to 2
Creating objects
• Right click on Objects on the task bar on the left column
• Click on Create Object
Object Properties
• Type in obj_dragon as
the name
• There is a small button
next to the Sprite bar,
click on it and choose
the “spr_dragon_left”
sprite
Add Event
• Click on Add Event and choose Create

2.

1.
Execute Code
• Click on the “Control” tab on the right hand column of this window
• Under the Code section, drag the Execute Code button (the first button)
to the Action box.

3. 1.
2.
Type in coding

• In the Execute Code window,


type in “dragon_speed = 30;”
• Close the window by clicking
on the Tick button.
Assign directions for keys
• Click on Add Event and then Key Press.
• Click on Left.
• Repeat the above steps for the other directions (Right, Up &
Down).
Execute Code on Key Press
• Click on the Press <Left> event on the Event column.
• Click on the “Control” tab on the right hand column of this window
• Under the Code section, drag the Execute Code button (the first
button) to the Action box.

1.
4.
2.
3.
Type in coding
• In the Execute Code window, type in “sprite_index = spr_dragon_left;”
for the first line and “x -= dragon_speed;” for the second line
• Close the window by clicking on the Tick button.
Execute Code for other
directions
• Using the same steps given above, type in and execute the
codes on these directions:
1. Press <Right>, type in “sprite_index = spr_dragon_right;” for
the first line and “x += dragon_speed;” for the second line
2. Press <Up>, type in “sprite_index = spr_dragon_up;” for the
first line and “y -= dragon_speed;” for the second line
3. Press <Down>, type in “sprite_index = spr_dragon_down;”
for the first line and “y += dragon_speed;” for the second line
Creating a room
• Right click on Rooms on the task bar on the left column
• Click on Create room.
Change the colour of the background
• Click on Backgrounds on the left • Choose dark green as the colour.
column
1. 2.
Add the dragon to the room
• Click on Objects in the left • Click once anywhere on the
column. green background to place the
dragon.
Play around with the dragon!
• Click on Ok
• Run the game!
Congratulations!
Lesson 1 completed!

You might also like