I have an enemy(fly) that is using the sine behavior. Every 2 seconds i want it to shoot at player(if player is visible).Moreover i want to restrict the enemy moves between 2 barriers.
This is what i tried thus far
Develop games in your browser. Powerful, performant & highly capable.
This will fix your fly problem by only allowing it to shoot when it is on-screen, and when a fireball is spawned it will set it's angle to the player.