vspeed

The vertical speed of the object.

Syntax:

vspeed


Returns: Real


Description

All instances in GameMaker: Studio have certain "built in" properties that you can use and set to govern how they look and behave. vspeed is one of those properties and defines the vertical movement speed of the instance in pixels per step. So, a vspeed of 3 means 3 pixels of movement down the screen (+y) every step, and a vspeed of -3 would mean 3 pixels of movement up the screen (-y) every step.


Example:

if keyboard_check(vk_up) vspeed = -5;
if keyboard_check(vk_down) vspeed = 5;

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


Back: Moving Around
Next: speed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved