How do I improve my platformers pathfinding

0 favourites
  • 9 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • 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.

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

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

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

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

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

  • You should post the capx blackhornet said, I can't see anyhting wrong from what you posted

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • have look at this and see if that helps you

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