diff options
author | Astatin <[email protected]> | 2024-10-10 18:08:10 +0900 |
---|---|---|
committer | Astatin <astatin@redacted> | 2024-10-10 18:08:10 +0900 |
commit | b4beaa96c563d3af9e41c0801f9fbba9d1acdccd (patch) | |
tree | 935b00b261fe1475742a66c5cbb863142d2972f8 /entity | |
parent | 10aed52daf8f06032342504c4a5fffa81031a90e (diff) |
Fox spawn in random rooms (but the first one randomly got all the same room rip)
Diffstat (limited to 'entity')
-rw-r--r-- | entity/actions.gbasm | 30 | ||||
-rw-r--r-- | entity/init.gbasm | 29 |
2 files changed, 56 insertions, 3 deletions
diff --git a/entity/actions.gbasm b/entity/actions.gbasm index f04a8f7..c001609 100644 --- a/entity/actions.gbasm +++ b/entity/actions.gbasm @@ -99,6 +99,34 @@ Fox_AI: CP $00 JP NZ, =Fox_AI.Start_action_or_movement.end + ; Is Bunny close enough to follow + LD A, $mem_bunny_x + SUB B + .ABS + CP $08 + JR NC, =Fox_AI.Random_walker + + LD A, $mem_bunny_y + SUB C + .ABS + CP $08 + JR NC, =Fox_AI.Random_walker + + JR =Fox_AI.Follow_bunny + + Fox_AI.Random_walker: + CALL =RNG_Step + LD E, $00 + RR A + RR E + SWAP E + AND $03 + INC A + OR E + LD D, A + JP =Fox_AI.Check_Collision + + Fox_AI.Follow_bunny: LD A, $mem_bunny_x LD $tmp_var_1, A @@ -202,7 +230,7 @@ Fox_AI: LD C, E Fox_AI.skip_invert_axis2: - Check_Collision: + Fox_AI.Check_Collision: LD A, D PUSH BC CALL =Get_Position_After_Move diff --git a/entity/init.gbasm b/entity/init.gbasm index 65f841f..e4a4c1a 100644 --- a/entity/init.gbasm +++ b/entity/init.gbasm @@ -72,9 +72,34 @@ Fix_Bunny_screen: Initialize_Fox: LD A, $0d LD (HL+), A - LD A, $mem_bunny_x + LD A, $mem_number_of_rooms + CALL =RNG_Bound + SLA A + SLA A + ADD $80 + LD C, A + + LD B, $c8 + + LD A, (BC) + LD D, A + INC BC + LD A, (BC) + INC A + CALL =RNG_Bound + ADD D + LD (HL+), A - LD A, $mem_bunny_y + + INC BC + + LD A, (BC) + LD D, A + INC BC + LD A, (BC) + INC A + CALL =RNG_Bound + ADD D LD (HL+), A LD A, $03 LD (HL+), A |