show path finding route

This forum is currently in read-only mode.
  • 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?

    Thanks.

  • Try Construct 3

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

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

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

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