aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--definitions.gbasm4
-rw-r--r--entity/actions.gbasm55
-rw-r--r--main.gbasm4
3 files changed, 53 insertions, 10 deletions
diff --git a/definitions.gbasm b/definitions.gbasm
index 1ada5a8..d623e55 100644
--- a/definitions.gbasm
+++ b/definitions.gbasm
@@ -80,6 +80,10 @@
; direction: u8 (animation = bit 7-4, bit 3 = is_moving, bit 2-0: direction),
; ai_function_pointer: 16
; _padding: u16
+;
+; # SANTA CHRISTMAS LIST PLEASE #
+; health, max health, list of possible attacks, maybe remaining attacks ? AI status (blind, scared, slow, etc..)
+;
; }
.DEFINE mem_oam_buffer $ca00 ; Until $ca9f
diff --git a/entity/actions.gbasm b/entity/actions.gbasm
index 5064c79..e8905cc 100644
--- a/entity/actions.gbasm
+++ b/entity/actions.gbasm
@@ -96,15 +96,57 @@ Fox_AI:
LD A, $mem_moving_animation_step
CP $00
JR NZ, =Fox_AI.Start_action_or_movement.end
- CALL =RNG_Step
- AND $03
- INC A
+
+ ; Choose direction
+
+ LD A, B
+ ADD $80
+ LD E, A
+ LD A, $mem_bunny_x
+ ADD $80
+ CP E
+ JR Z =Fox_AI.Vertical
+ JR NC =Fox_AI.Go_Left
+
+ Fox_AI.Go_Right:
+ LD A, $enum_direction_left
+ JR =Fox_AI.Direction_check_end
+ Fox_AI.Go_Left:
+ LD A, $enum_direction_right
+ JR Z =Fox_AI.Direction_check_end
+
+ Fox_AI.Vertical:
+ LD A, C
+ ADD $80
LD E, A
- CALL =RNG_Step
- AND $08
- OR E
+ LD A, $mem_bunny_y
+ ADD $80
+ CP E
+ PUSH AF
+ PUSH HL
+ LD HL, $9800
+ LD A, $00
+ RL A
+ CALL =Print_8bit
+ POP HL
+ POP AF
+
+ JR Z =Fox_AI.Start_action_or_movement.end
+ JR C =Fox_AI.Go_Up
+ Fox_AI.Go_Down:
+ LD A, $enum_direction_down
+ JR =Fox_AI.Direction_check_end
+ Fox_AI.Go_Up:
+ LD A, $enum_direction_up
+
+ Fox_AI.Direction_check_end:
+
+ OR $08
LD D, A
+ ; Check collision
+
+ Check_Collision:
PUSH BC
CALL =Get_Position_After_Move
LD A, C
@@ -115,6 +157,7 @@ Fox_AI:
JR Z, =Fox_AI.Start_action_or_movement.not_collision
RES 3, D
Fox_AI.Start_action_or_movement.not_collision:
+
Fox_AI.Start_action_or_movement.end:
Fox_AI.End_movement:
diff --git a/main.gbasm b/main.gbasm
index 3ae5cf4..a3447d2 100644
--- a/main.gbasm
+++ b/main.gbasm
@@ -26,10 +26,6 @@ VBLANK_Entrypoint:
CALL =Display_Object
CALL $OAM_DMA_Transfer_routine
- LD HL, $9800
- LD A, ($c98b)
- CALL =Print_8bit
-
CALL =Object_Interactions_Check
CALL =Pad_Button_Check