hspeed
Returns: Real
All instances in GameMaker: Studio have certain "built in" properties that you can use and set to govern how they look and behave. hspeed is one of those properties
and defines the horizontal movement speed 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.
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.