If distance( Pirate.X, Pirate.Y, Player.X, Player.Y ) < 50
| If angle( Pirate.X, Pirate.Y, Player.X, Player.Y ) < 0
| If angle( Pirate.X, Pirate.Y, Player.X, Player.Y ) > 180
| Pirate rotate to the left
|
| If angle( Pirate.X, Pirate.Y, Player.X, Player.Y ) < 180
| If angle( Pirate.X, Pirate.Y, Player.X, Player.Y ) > 0
| Pirate rotate to the right
| = "if distance" event block.
You'll need to adjust the angle tests if you want it within a certain range.