aboutsummaryrefslogtreecommitdiff
path: root/bunny.gbasm
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-08-22 18:17:04 +0900
committerAstatin <astatin@redacted>2024-08-22 18:17:04 +0900
commitf0d9de7afa943ebd41c1b202690b2ab3e387f708 (patch)
treeffd085c9a6182b67ef44a506a2728057f72f5d12 /bunny.gbasm
parent358e97cc2628d4617543d20d2c40111699f067d6 (diff)
Stored the rooms + spawn the bunny at the top left (sometimes) of the room
Diffstat (limited to 'bunny.gbasm')
-rw-r--r--bunny.gbasm46
1 files changed, 36 insertions, 10 deletions
diff --git a/bunny.gbasm b/bunny.gbasm
index 702b464..19009d7 100644
--- a/bunny.gbasm
+++ b/bunny.gbasm
@@ -1,16 +1,42 @@
Initialize_Bunny:
- LD A, $10
+ 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 $mem_bunny_x, A
- LD A, $10
+
+ INC BC
+ INC BC
+
+ LD A, (BC)
LD $mem_bunny_y, A
- LD A, $b8
- LD $reg_viewport_x, A
- LD A, $c8
- LD $reg_viewport_y, A
- LD A, $0b
+
+ LD A, $mem_bunny_x
+ SUB $05
LD $mem_viewport_x, A
- LD A, $0c
+
+ LD A, $mem_bunny_y
+ SUB $04
LD $mem_viewport_y, A
+
+ LD A, $mem_viewport_x
+ SWAP A
+ AND $f0
+ OR $08
+ LD $reg_viewport_x, A
+
+ LD A, $mem_viewport_y
+ SWAP A
+ AND $f0
+ OR $08
+ LD $reg_viewport_y, A
+
LD A, $50
LD $mem_bunny_x_px, A
LD A, $40
@@ -55,7 +81,7 @@ Move_Bunny:
CALL =Is_Solid
CP $00
- ; JR NZ, =Move_Bunny.collision
+ JR NZ, =Move_Bunny.collision
LD B, D
@@ -85,7 +111,7 @@ Move_Bunny:
CALL =Is_Solid
CP $00
- ; JR NZ, =Move_Bunny.collision
+ JR NZ, =Move_Bunny.collision
LD B, D