Lesson 1 - Create Sprites and Objects
Lesson 1 - Create Sprites and Objects
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
• On the Name
column, type in
“spr_dragon_right”
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
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!