GameMaker calculate the Object's speed with xprevious and yprevious?

143 views Asked by At

Can't calculate speed based on that.

I'm using paths to move objects so built in direction is speed is always zero?

How can I calculate the real speed of the object?

No matter what xprevious is always x and y previous is always y.

1

There are 1 answers

0
YellowAfterlife On

The speed that you've originally set an object to follow a path with can be found in path_speed variable, but for paths with varying per-point speeds you can calculate it yourself by checking distance in an End Step event:

spd = point_distance(xprevious, yprevious, x, y);

enter image description here