How do I make a simple ai that moves around a solid square

  • I followed a guide that allowed for edge detection and it worked perfectly.Now using the 8direction move behavior I'm trying to make an ai that will move around a rectangle.

    I had a couple ideas of how to make this work but it didn't go the way I hoped. So in the guide using one imagepoint the ai can detect when it's on the edge, so I tried to emulate this example but with 4 imagepoints corresponding to the 4 directions.

    Without doing the whole thing at once, I first tried to see if it'd register one of the image points but for some reason the monsterdetector2 sprite won't redirect it's position to the bottom of the circle where the bottom image point is set. I confirmed this by going into debugging mode and seeing if the monsterdetector2 sprite moved at all but it just remained in the same place.

    I've tried looking up guides on this topic with no avail, so I'm currently stumped. I've added an attachment if you want to test out my problem for yourself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • have you try this one?

    ww*.sci*ra.c*m/tutorials/756/setting-custom-paths-using-waypoints

  • Thanks. That gave me a few more ideas. I did end up using waypoints, but in a simpler way then in the demo, though admittingly with less functionality/flexibility.

  • Here's one way here using detector sprites:

    For just a rectangle you can get away with having only 1 detector, I used 3 to handle crevices.

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