xprevious

The previous x position of the instance.

Syntax:

xprevious


Returns: Real


Description

This built-in variable returns the previous x position for the instance. This variable will be set just before the start of the begin step event but it can also be set through code at any time, meaning you can give it your own custom value should that be necessary.


Example:

if x != xprevious || y != yprevious
   {
   moved = true;
   }

The above code checks to see if there is any difference between the xprevious and yprevious values and the current x and y values. If there is it sets a variable to true.


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