I've got a pretty simple platformer, and I'm trying to get my enemy AI to patrol back and forth on the platform, without walking off the side. The best solution I have found thus far is to place invisible walls that, on overlap with the enemy sprite, trigger the sprite to walk the other direction (I'm using an instance variable for this: Patrol = 0 => simulate control right, Patrol = 1 => simulate control left). However, with a lot of enemies on a lot of platforms, that's a lot of invisible walls to build and keep track of.
So basically, I'm trying to cheat a lil bit :/
I created two image points on my enemy sprite, located just outside the collision polygon, and just below, on either side. I named them "floordetectorright" and "floordetectorleft". The issue I'm having is that I can't find a way to reference these image points in a condition. My goal is something like:
floortile is NOT overlapping point (sprite.imagepointX("floordetectorright"), sprite.imagepointY("floordetectorright")) => set patrol to 1
The above would check whether the floor detector image point is overlapping with the floor, and if it isn't, it would trigger a change in direction. However, I'm not really seeing a way to do this. I tried messing around with Pick Object Overlapping Point, but that didn't seem to work.
Any ideas? Or should I start building a fortress of invisible walls?