GAME MAKER STUDIO TUTORIAL
MINI TUTORIAL 01 – ARROW MOVEMENT (UFO)

separator-blank.png

DESCRIPTION

·        In this mini tutorial, you will learn how to move an object around using the arrow keys.

RESOURCES

·        Click here.

STEPS

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.

 

OTHER VERSIONS

·       GameMaker 1.4

SOURCE

  • Straight from Mr. Campeau's brain.  J

separator-campeau.png