How do I improve my platformers pathfinding

Get help using Construct 2

Post » Thu Jul 03, 2014 12:40 pm

Message: Mic is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I'm building a platformer game, and used various on site tutorials including the tutorials' section on enemy movement.
()

I got it working, but it isn't 100% reliable. Sometimes enemy units will fall from their platforms, completely ignoring the invisible walls.
I have no idea's anymore on how to fix this issue. (And I have searched through these forums for a solution). I'd be very grateful if anyone has any tips for solving this.

Attached is the event sheet of the enemy movement.
You do not have the required permissions to view the files attached to this post.
B
3
Posts: 4
Reputation: 183

Post » Thu Jul 03, 2014 12:44 pm

The 'On collisions' are triggers and can not be buried in the For loop. Drag that event out of the For loop and it will work better.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Thu Jul 03, 2014 1:22 pm

Thank you blackhornet, I did remove the 'On Collisions' from the for loop, but it didn't fix the issue.
I think it might be that the enemy units collide with the EdgeDetection object twice (instantly), thus their direction isn't changed and they fall of a ledge.
I have tried putting two edge detect objects next to each other but that also doesn't seem to fix the issue.
B
3
Posts: 4
Reputation: 183

Post » Thu Jul 03, 2014 1:45 pm

You should post a CAPX so someone can have a look. Use Dropbox and add a space to the link (since you don't have permission to post "real" URLs yet).
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Thu Jul 03, 2014 2:02 pm

Does all frames of your EnemyAnimation use the same collision box? if not try forcing them to do so, as it can cause some bugs if they are different.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Fri Jul 04, 2014 10:16 am

caiorosisca wrote:Does all frames of your EnemyAnimation use the same collision box? if not try forcing them to do so, as it can cause some bugs if they are different.


Indeed they do, and each animation frame uses a rectangular collision box.
B
3
Posts: 4
Reputation: 183

Post » Fri Jul 04, 2014 1:50 pm

You should post the capx blackhornet said, I can't see anyhting wrong from what you posted
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Mon Jul 07, 2014 10:55 am

I found a solution to the pathfinding problem.
I added a boolean value to the enemy instance variables which checks if the unit is colliding the CollisionDetection,

>Enemy Is true>Wait 0,1 sec, Set False

If it's false The unit reverses its direction, but if it's true the unit can not change its direction.
So far this seems to have solved the problem.
B
3
Posts: 4
Reputation: 183

Post » Wed Jul 09, 2014 8:04 am

have look at this and see if that helps you
You do not have the required permissions to view the files attached to this post.
B
257
S
42
G
15
Posts: 1,992
Reputation: 41,415


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests