hspeed


Description

hspeed is one of the "built in" properties that all instances have and defines the horizontal movement speed (along the x-axis) of the instance in pixels per step. So, an hspeed of 3 means 3 pixels of movement to the right (+x) every step, and an hspeed of -3 would mean 3 pixels of movement to the left (-x) every step.


Syntax:

hspeed;


Returns:

Real (single precision floating point value)


Example:

if keyboard_check(vk_left) hspeed = -5;
if keyboard_check(vk_right) hspeed = 5;

The above code will change the horizontal speed depending on which keys are pressed.