GameMaker IDE
Version 2022.11
1 –
Creating the ufo object.
·
Create
a ufo sprite (sprUfo) and import the corresponding image from the resources
folder.
·
Create
a ufo object (objUfo) with the sprite from above.
·
Open
the pre-created room. With the
Instances layer selected, drag in an objUfo.
2
– Background
·
Create
a mars background sprite (sprMars) using the corresponding image from the
resources folder.
·
Open
the room. Click on the Background
layer. At the bottom, select the
sprMars as the sprite for the background.
Choose the Stretch option.
3 – Moving
right.
·
In
the ufo object, add a Key Down > Right event.
·
In
the above event, add an Assign Variable action (common tab)
o
Variable:
x
o
Value:
5
o
Check
relative
4 – Moving
left.
·
In
the ufo object, add a Key Down > Left event.
·
In
the above event, add an Assign Variable action (common tab)
o
Variable:
x
o
Value:
-5
o
Check
relative
5 – Moving
up.
·
In
the ufo object, add a Key Down > Up event.
·
In
the above event, add an Assign Variable action (common tab)
o
Variable:
y
o
Value:
-5
o
Check
relative
6 – Moving
down.
·
In
the ufo object, add a Key Down > Down event.
·
In
the above event, add an Assign Variable action (common tab)
o
Variable:
y
o
Value:
5
o
Check
relative
Save and test the
game. The ufo should now move around
with the arrow keys.
|