GameMaker
IDE Version 2022-11
1 –
Creating our sprites
·
Create
7 sprites and load one of the button images in each one.
o
Name
the sprites after the text on the button
·
Create
a sprite with the dragonAnimation.gif image.
o
Name:
spr_dragon
2 – Create
8 objects – one for each sprite above.
·
The
dragon object needs to be named: obj_dragon
3 – PLAY
button
·
In
the Play button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
1
4 – PAUSE
button
·
In
the Pause button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
0
5 –
BACKWARDS button
·
In
the Backwards button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
-1
6 – FAST
button
·
In
the Fast button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
2
7 – SLOW
button
·
In
the Slow button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
0.5
Explanation: Notice that the five buttons we've done
so far have very very similar actions in them. The only difference is the value of the
dragon object's image_speed. The
reason that each of the Assign Variable actions specify
"obj_dragon.image_speed" instead of just "image_speed"
is to change the value of "image_speed" inside the obj_dragon
object.
8 – FIRST
button
·
In
the First button object, add a Mouse > Left Pressed event.
·
Inside,
add a Assign Variable action
o
Variable:
obj_dragon.image_index
o
Value:
0
·
Inside,
add a Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
0
9 – LAST
button
·
In
the Last button object, add a Mouse > Left Pressed event.
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_index
o
Value:
72 (the GIF's
last frame is #72)
·
Inside,
add an Assign Variable action
o
Variable:
obj_dragon.image_speed
o
Value:
0
10 – Adding
objects to our room
·
Create
a room. Size it as you wish.
·
Add
one of each of the button objects.
Place them where you'd like.
·
Add
one obj_dragon.
Save and test!
|