Selim Kaltakkıran
Selim Kaltakkıran

Reputation: 1

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

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.

Upvotes: 0

Views: 227

Answers (1)

YellowAfterlife
YellowAfterlife

Reputation: 3202

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

Upvotes: 1

Related Questions