Please add "dropbox.com" before the below link and paste it in your browser to download the project.
I want this sprite to change direction when it hits the edge marker. It works but sometimes it automatically ignores the edge marker and falls off the platform.
Hasn't this already been dealt with here https://www.scirra.com/forum/viewtopic.php?f=152&t=129207&p=909143#p909143 ?
Develop games in your browser. Powerful, performant & highly capable.
No, that was a different problem. At that time, the sprite got stuck in the middle of the platform and your suggestion helped me fix it. But this time, the sprite sometimes falls off the platform without colliding with the edge marker and changing its direction.
It could be that the animation frames of your enemy sprite are not uniform size. If you run in debug you can see that when the collision marker is collided with and your sprite is animating, then it triggers the change of the 'IsLeft' instance variable more than once. Hence, it looks like a bug and not colliding, but it is working correctly.
If you look at Ashley's platform tutorial, you'll see he advocates using a uniform sized invisible dummy sprite that has the behaviors assigned to it, and the animations are just then pinned to it. That way, collisions should trigger exactly, and not get confused by the animations.
Thank You so much for helping it is working quite well now!