There are many different ways you could do this and it's probably worth checking through the FAQ and doing a forum search to see how other people would solve this.
For me, I would give my enemy a Boolean variable WalkingRight and put a couple of invisible obstacles on the layout where I want the enemy to change direction. I would give my obstacles each a Boolean variable as well, something like ChangeToWalkLeft - the obstacle on the right would then have this set to true and the one on the left set to false (this prevents double collisions giving you problems later).
Then in the event sheet, the enemy controls would be:
- if enemy.WalkingRight = true ; simulate platform press right
- if enemy.WalkingRight = false ; simulate platform press left
-> On enemy collision with obstacle
---> if obstacle.ChangeToWalkLeft = true ; enemy.WalkingRight = false
---> if obstacle.ChangeToWalkLeft = false ; enemy.WalkingRight = true
I hope my text version of the events you need makes sense...
Have a look through the FAQ as I said at the start, there are some great examples of how to do all sorts of things with C2. Enough to take up your whole weekend... <img src="smileys/smiley1.gif" border="0" align="middle">