vspeed

Drag & Drop equivalent: GM006

 

Reverse hspeed - D&D equivalent: GM009 (See below)

 

Example:

vspeed = 5

 

vspeed holds the vertical speed of the object. A plus number (as in the example above) means the object is moving down, a minus number (vspeed = - 4) means the object is moving up. This is useful if you want an object with one image that you want to face up and down (to save filesize), like an enemy spaceship in a top-down shooter, you can check the vspeed of the object, if it's less that 0, it's moving up, if it's greater than 0, it's moving down.

 

// Flip the image so it's looking in the right direction

// GM V6.x

if vspeed < 0

{

image_yscale = 1

}

else

{

image_yscale = -1

}

 

You can also use vspeed to reverse an objects vertical motion.  For example, putting the following code inside an enemies collision with something:

 

vspeed = -vspeed;

 

Revision #3