hspeed


描述

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.


语法:

hspeed;


返回:

Real(实数)


例如:

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.