I'm working on an enemy that crawls around on a ladder. It uses the Bouncy Ball movement, and its AI is supposed to make it rotate counterclockwise whenever it moves off of the ladder, so that it remains on top of it. Here is the code:
NOT x("enemy"),y("enemy") is a ladder:
-set direction to dir("enemy")+2
-set angle to dir("enemy")*360/32
The enemy's behavior is basically correct when I test it, but there's a big problem. Do you know what it is?
Yep, you guessed it. It breaks when there's more than one of them. It only follows the behavior of the first instance of the enemy, and applies the action to both of them when the condition for that one enemy is met.
Any way I can rewrite this code so that it handles each enemy separately?