Pathfinding in reverse

Get help using Construct 2

Post » Sat Apr 20, 2013 2:54 am

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?
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Sat Apr 20, 2013 3:37 am

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.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Sat Apr 20, 2013 4:01 am

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.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902


Return to How do I....?

Who is online

Users browsing this forum: heliogame, WhosWho and 20 guests