Pathfinding from offscreen?

Get help using Construct 2

Post » Tue Jul 09, 2013 4:58 am

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:

https://dl.dropboxusercontent.com/s/rfrh54q1p8vvp38/Tower%20Defense.capx?token_hash=AAGlP_e7_-QsRG4ewwoAQ9kNc_9hMR9wDlf2i2Z30dP3zQ&dl=1Tylairus2013-07-09 05:02:57
B
3
Posts: 6
Reputation: 187

Post » Tue Jul 09, 2013 9:55 am

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
B
17
S
8
G
4
Posts: 473
Reputation: 6,221

Post » Tue Jul 09, 2013 11:51 pm

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.
B
3
Posts: 6
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests