Pathfinding in reverse

0 favourites
  • 3 posts
From the Asset Store
Energy Effects Volume 3
$2.50 USD
50% off
Animated portals including normal and reverse animations in HD and 8-bit.
  • Hey all,

    I have been playing around with a little tank game in my spare time. I wanted to know how I could make it so that when a tank finds a path, if it's quicker to travel backwards instead of rotating all the way around, it does that.

    I've tried a few ways, mainly setting the angle of the tank 180 from where it is and mirroring the sprite before calculating the path, but surprisingly it seems to completely ignore this angle change. Even if I disable pathfinding, change the angle, wait one second, then enable pathfinding and find path it still just carries on as if its angle was never changed.

    So, any ideas? Has anyone been through this before?

  • You could use the car movement behavior in conjunction with the pathfinder behavior. Instead of moving the tank with the pathfinder behavior, just use it to find the path. Then use the car behavior to follow that path, and leave a condition saying that if the next node is closer to the front then go forward, or if closer to the back go backwards.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply, but it's a bit too involved for me (it's just a muck around project for when I need a break from my RPG). I tried doing what you suggested when pathfinding first came out, but it got pretty messy and I never could get it to behave exactly how I wanted.

    If there's no simple way to about-face, I'll just leave it as is I reckon.

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