I am making a platform game and there I want to add a flying enemy. I want- 1. When my player is near to flying enemy it changes it's direction towards enemy 2. Else, it keep on moving forward and backward in a defined area.
For this I have added Sine behavior to my enemy and it's properties Movement: Horizontal and when enemy collide with an invisible sprite (like edgeDetector) it is set mirrored. But, when my enemy collide with wall it is not set mirrored/changes it's direction. I also did the same with adding bullet behavior in place of Sine behavior. ** All the other properties are also checked like - collision: enabled (Done) Z order (both enemy and wall are on 'Main' layer)
Please help me out and provide me an example similar to this.