yprevious

The previous y position of the instance.

Syntax:

yprevious


Returns: Real


Description


It can often be useful to know where an instance was the previous step, when resolving collisions for example, and so you can use this function to get that value for use. It is normally stored just before the start of the begin step event but can 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 yprevious and yprevious values and the current x and y values. If there is it sets a variable to true.


Back: Moving Around
Next: xstart
© Copyright YoYo Games Ltd. 2015 All Rights Reserved