From 7faf16e4453f935ee1159d32ddc2a6501ea91bbb Mon Sep 17 00:00:00 2001 From: Astatin Date: Tue, 29 Apr 2025 11:40:31 +0200 Subject: Give a turn for the enemies to turn around when bunny is behind them --- enemiesattacks/laser.gbasm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'enemiesattacks/laser.gbasm') diff --git a/enemiesattacks/laser.gbasm b/enemiesattacks/laser.gbasm index caf6db2..c26e4e3 100644 --- a/enemiesattacks/laser.gbasm +++ b/enemiesattacks/laser.gbasm @@ -1,4 +1,20 @@ Laser_sight_check: ; BC = XY of the enemy. D is unchanged. Direction to face in E (or 0 if not) + LD A, E + DEC A + DEC D + XOR D + INC D + CP $00 + JR Z, =.attack + BIT 1, A + JR NZ, =.attack + + LD A, E + OR $00 + LD D, A + RET + + .attack: LD E, $00 ; straight line + distance <= 4 -- cgit v1.2.3-70-g09d2