Pathfinding in reverse

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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)