path_positionprevious

The calling instance's position on the path in the previous step.

语法:

path_positionprevious;


返回: Real(实数)


描述

This variable can be used to get or to set the position of an instance along its current path in the previous step, and is a normalised value between 0 and 1 ie: 0 is the start position of the path and 1 would be the end position. It is similar to the xprevious and yprevious functions in how it works, only it is specific for paths. It can be useful for things like temporarily stopping a path follower if something is in the way (see the example code below).


例如:

var xx, yy;
xx = x + lengthdir_x(16, direction);
yy = y + lengthdir_y(16, direction);
if collision_circle(xx, yy, 16, obj_Player, false,true) path_position = path_positionprevious;

The above code checks an area in front of the instance for a collision with the object "obj_Player" and if there is one, it sets the instance back to the previous position it occupied on the current path.


上一页:路径
下一页: path_speed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved