How do I update path of enemy with "Pathfinding"

Just started using Construct 2? Post your questions here

Post » Thu Feb 12, 2015 4:39 pm

Hello. I'm creating a tower defense game where I make maze for enemies by myself. But there is a problem: when enemy is moving on screen, it ignores recently built blocks and moves trough them. Can you help me to fix it? I can't provide a sample because I can't paste links.
B
25
S
13
G
6
Posts: 155
Reputation: 5,542

Post » Thu Feb 12, 2015 5:00 pm

When you need to update the possible path, you need to use the "Regenerate Obstacle Map" or "Regenerate Region Around Object" actions. Remember, the map is only created at start of the layout unless you regenerate it with one of these actions. Also, regenerating the map is very CPU intensive and could cause slow down in your game if you are doing it often.
B
38
S
12
G
11
Posts: 329
Reputation: 7,708


Post » Thu Feb 12, 2015 7:20 pm

Event 4 move the Regenerate action before the Find Path action.
B
38
S
12
G
11
Posts: 329
Reputation: 7,708


Post » Thu Feb 12, 2015 9:09 pm

I believe you can make that wait 0.0 and it will still work, as it won't run until the next step, if I'm remembering correctly.
ImageImageImageImage
B
53
S
19
G
51
Posts: 633
Reputation: 30,571


Post » Thu Feb 12, 2015 9:51 pm

Sorry to conjecture when I'm not on my laptop at the moment, but, isn't there a trigger for "on regenerate obstacle map" that you can use instead of the wait function?
ImageImageImageImage
B
53
S
19
G
51
Posts: 633
Reputation: 30,571


Post » Fri Feb 13, 2015 1:26 am

You will be better off, just regenerate the region around where the new obstacle is. It will improve performance.
B
44
S
11
G
2
Posts: 1,177
Reputation: 6,783


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests