0 Favourites

Enemy pathfinding

This forum is currently in read-only mode.
  • Hello guys! I'm creating AI for my platformer. I need to make enemy to turn back before falling from edge of platform. I thought that it may be done using "overlaps at offset" condition. I tried different values of x and y but failed <img src="smileys/smiley18.gif" border="0" align="middle" /> Maybe you can give some advice, because I don't want to put bouncer objects at the edge of eah platform.

  • There's a number of ways to do this, the most straightforward ones involve detectors. Instead of manually setting up invisible objects to each platform edge that are used by the AI to detect it you could just create them in the runtime by making use of image points and families.

    Say, start of layout for each of the family Platform -> create detector left on image point xy, create detector right on image point xy.

    You could also use detectors positioned to the feet of the enemies and make the turning condition true whenever the detector DOESN'T touch the platform.

    It doesn't get much easier than this if you don't want to compare the distance an enemy has walked to the width of the platform which isn't exactly a smart way of doing it.

  • If you have more enemies than platform edges it might be better to make the static invisible objects at runtime for each platform instead (same idea, but stuck to the platform instead of AI). Then there is less objects, and it should work the same way.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks a lot guys! I'll try that methods.

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