Pathfinding from offscreen?

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello,

    I'm attempting to path-find from off-screen but it does not work. My enemies spawn about 32 pixels above the path they should be walking on, but are unable to find a path.

    What could be preventing them from finding the path when they're directly beside it? Is it even possible to spawn outside the layout and path-find back in?

    As I still cannot post links, here's the big ugly Dropbox Url for the capx:

  • I think the pathfinding isn't made for finding paths outside of the layout. If it was, that means that a sprite could "choose" to go from A to B in a maze by running around it ^^

    That said, you have 3 solutions.

    First, you can make your layout bigger, letting them spawn inside the layout. You just have to set the scroll to the center of your level, so mobs spawn can't be seen and it looks like they walk inside the layout.

    Second, you can, after a mob spawns, make him walk inside the layout first and then look for a path to the destination.

    Third and last, you can change the spawning point. I just moved the "origin" point of your spawning zone and it works nicely right now : capx

  • 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 response. Yeah, I notified if I move the origin right down align with the top of the layout, it will work. However, the reason I didn't jump right to doing that is the enemy tends to rotate on screen, which would give nearby towers and unfair advantage while it stands still.

    I tried adding On Created -> Rotate clockwise 90 degrees, Set Angle -> 90 degrees, and even stuff like Rotate degrees, but it is always facing right no matter which action I used. I'm probably missing something, as I haven't has an issue with rotating previously.

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