To move an instance, you can modify its x
and y
properties. x
is the instance’s horizontal position, and y
is the vertical position.
// Moves the instance to 320, 400 in the room
x = 320;
y = 400;
You can also use the built-in variables hspeed
and vspeed
to set the horizontal speed and vertical speed of the instance, respectively.
// Tells the instance to move left horizontally, and down vertically
hspeed = -4;
vspeed = 4;
This should automatically make them move, once you set the speed value(s).
However, it is recommended to create your own variables for movement, usually called hsp
and vsp
. You can add them to the x
and y
variables respectively, in the Step event.
hsp = -4;
vsp = 4;
x += hsp;
y += vsp;