I've been struggling with this enemy behavior for hours now and can't seem to come up with a decent solution. The game is a platformer, BTW. What I'm looking to do seems simple enough and is illustrated by this image. I just want the enemy to follow along the edge of a tiled background objects.
<img src="https://dl.dropbox.com/u/28484936/enemy_problem.png" border="0" />
Think of those little spiny enemies in Metroid that can crawl around a platform.
<img src="http://www.consoleclassix.com/info_img/Metroid_NES_ScreenShot4.jpg" border="0" />
I've been using a lot of "overlap at offset" events to set the enemy's speed and direction but I keep ending up with the object floating into space or moving through the background. The only solution I can come up with is to place a series of sprites at the corners that act as sensors, but it's not a very elegant solution. If anyone has an idea on how to make this work, I'd really appreciate it.