aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-05-20 10:21:57 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-05-20 10:21:57 +0100
commit85d5a45f08dd47e76f733fd027bb3df3d7b1948a (patch)
tree6b1877181df24241055239e3be7131c44c05b9ff
parentccf1ea4a34a789da326a321589c2757e5b1d749c (diff)
downloadtr8vm-85d5a45f08dd47e76f733fd027bb3df3d7b1948a.tar.gz
tr8vm-85d5a45f08dd47e76f733fd027bb3df3d7b1948a.zip
Enforce game playe area limits
-rw-r--r--game/player.asm21
1 files changed, 20 insertions, 1 deletions
diff --git a/game/player.asm b/game/player.asm
index ef63839..9683905 100644
--- a/game/player.asm
+++ b/game/player.asm
@@ -21,12 +21,21 @@ player_update:
; left
bit b, 4
- bz
+ bnz
+ jmp player_not_left
dec y
+ bo
+ ld y, 0
+player_not_left:
; right
bit b, 5
+ bnz
+ jmp player_not_right
+ cmp y, 112
bz
+ jmp player_not_right
inc y
+player_not_right:
ld [a : x], y
@@ -38,12 +47,22 @@ player_update:
; up
bit b, 2
+ bnz
+ jmp player_not_up
+ cmp y, 16
bz
+ jmp player_not_up
dec y
+player_not_up:
; down
bit b, 3
+ bnz
+ jmp player_not_down
+ cmp y, 112
bz
+ jmp player_not_down
inc y
+player_not_down:
ld [a : x], y