show path finding route

For questions about using Classic.

Post » Sat Sep 05, 2009 10:05 am

My units move with rts behaviour for pathfinding purposes, and i'm trying to find a way to show the path a selected unit would take before the player decides to move it.

My initial thought was to have an invisible object with rts behaviour and constantly move it starting at the selected units position to the mouse position, and loop it over again and again once it reaches its destination (incase player moves mouse pisition and the route changes). Along the way this invisible object would create other visible objects which would mark the path.

i have 2 problems, the first is moving the invisible object fast enough, and how to spawn the markers at consistant points along the way.

Any help, or other ideas this could be accomplished?

Posts: 735
Reputation: 12,142

Post » Sat Sep 05, 2009 1:56 pm

Off the top of my head I would say use the los behavior.
You could have a dummy object move, then when it has to turn spawn another dummy, etc till you reach the end point. You could also use the line object to show the path.
Problem is that rts may not chose that path, unless you force it.
Image ImageImage
Posts: 8,626
Reputation: 124,028

Post » Sun Sep 06, 2009 5:44 am

I haven't worked at all with what I'm going to suggest, so no idea if it'll work, but maybe it'll help. If the RTS pathfinding stuff will put out X,Y before it moves, store them in variables. Then use the Line object to draw lines from PointA.xy to PoitB.xy to PoitC.xy ...yada yada. Possibly adding some little graphic at each of those points before it branches off.

Again, I don't know at all what the path finding or Line objects actually look like, but hope that'll work.

Maybe use a Hash table with hash names like Option1_PointA, Option1_PointB, Option2_PointA, Option2_PointB if you're wanting to be able to swap between a few different path views.
Posts: 114
Reputation: 1,553

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest