From 7d6e13343c2a6c68e3f829c440af2ccf78b6d04f Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 22 Aug 2019 11:28:18 -0400 Subject: [PATCH] ootw: initial alien AI just turns to look at you if you're on the same level --- ootw/alien.s | 33 +++++++++++++++++++++++++++++++-- ootw/ootw_c2_jail.s | 3 +++ ootw/ootw_c4_city.s | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/ootw/alien.s b/ootw/alien.s index 25639dde..6160b193 100644 --- a/ootw/alien.s +++ b/ootw/alien.s @@ -30,7 +30,7 @@ A_TURNING = 4 A_YELLING = 5 A_SHOOTING_UP = 6 A_DISINTEGRATING = 7 - +A_SHOOTING = 8 alien_gait: alien0_gait: .byte 0 @@ -56,7 +56,7 @@ alien_gun: ; move_alien: - ; FIXME: loop through all alieans + ldx #0 move_alien_loop: @@ -74,6 +74,10 @@ move_alien_loop: beq move_alien_yelling cmp #A_SHOOTING_UP beq move_alien_yelling + cmp #A_STANDING + beq move_alien_standing + cmp #A_SHOOTING + beq move_alien_shooting done_move_alien: @@ -135,8 +139,33 @@ alien_no_move_run: move_alien_standing: + ; turn to face physicist if on same level + lda PHYSICIST_Y + cmp alien_y,X + bne done_move_alien_standing + + lda PHYSICIST_X + cmp alien_x,X + bcs alien_face_right + +alien_face_left: + lda #0 + beq alien_done_facing +alien_face_right: + lda #1 + +alien_done_facing: + sta alien_direction,X +done_move_alien_standing: + jmp done_move_alien + + ;====================== + ; shooting + +move_alien_shooting: + jmp done_move_alien astate_table_lo: diff --git a/ootw/ootw_c2_jail.s b/ootw/ootw_c2_jail.s index e3819986..6f803c7f 100644 --- a/ootw/ootw_c2_jail.s +++ b/ootw/ootw_c2_jail.s @@ -595,6 +595,9 @@ c2_done_draw_friend: lda ALIEN_OUT beq no_draw_alien + + jsr move_alien + jsr draw_alien no_draw_alien: diff --git a/ootw/ootw_c4_city.s b/ootw/ootw_c4_city.s index d57ac8e6..74bd0757 100644 --- a/ootw/ootw_c4_city.s +++ b/ootw/ootw_c4_city.s @@ -658,6 +658,8 @@ after_draw_physicist: lda ALIEN_OUT beq no_draw_alien + + jsr move_alien jsr draw_alien no_draw_alien: