How to check if an object is accelerating (Pathfinding)

Not favoritedFavorited Favorited 0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello.

    I have a game object travelling along a path using the Pathfinder behaviour. I want to find out if the object is accelerating. I can get the object's current speed along the path, but I can't work out how to find or calculate an object's speed in the previous tick / frame.

    I've tried checking the speed in every tick, waiting a short time, then checking it again, but this does not work. I've also tried using Pathfinder's built in 'compare speed' function to compare the object's speed to a previously recorded value stored in an instance variable. But it does not work either. I may well be missing something simple or obvious, but any help would be great. I've been away from Construct for some time, so am a little rusty.

    Cheers,

    T

    Tagged:

  • Obj.Pathfinding.Speed expression will give you the current speed. You can save it in a variable on every tick to check if the object is accelerating.

    if Obj.Pathfinding.Speed>savedSpeed : // is accelerating
    
    On every tick: Set savedSpeed to Obj.Pathfinding.Speed
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you for clarifying it. I was being too complicated!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)