From 85d5a45f08dd47e76f733fd027bb3df3d7b1948a Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 20 May 2023 10:21:57 +0100 Subject: Enforce game playe area limits --- game/player.asm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'game') 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 -- cgit v1.2.3