From: Lukas Krickl Date: Sun, 17 Nov 2024 20:05:44 +0000 (+0100) Subject: Reworking player input handling for turn-based movement X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=6c9f37677e3515bb5a86b9c2e467438b24dcaf33;p=gbrg%2F.git Reworking player input handling for turn-based movement --- diff --git a/src/player.s b/src/player.s index 9f11eca..4abe639 100644 --- a/src/player.s +++ b/src/player.s @@ -73,14 +73,13 @@ player_init: ; hl: pointer to player memory player_update: ; update + ld a, [who] + cp a, WHO_PLAYER + jp nz, @skip_input ; set collision mask ld a, RF_WALL ld [ct_mask], a - - ; d: player_y - ; e: player_x - ; b: obj flags mask ; input handling @@ -207,13 +206,25 @@ player_update: ; hl is ok to use again ; bc is free ; de is still used + dec hl ; hl = player_y = player start + +@skip_input: + ; hl should be player_y here + + ; d: player_y + ; e: player_x + ; b: obj flags mask + ld a, [hl+] ; hl = player_x + ld d, a ; d = player_y + ld a, [hl] + ld e, a ; e = player_x + dec hl ; hl = player_y ; check if i-frame ; if iframe is divisible by 2 ; flash all sprites off ; otherwise continue with regular code ; hl = player_x - dec hl ; hl = player_y = player start ld bc, player_timer_i add hl, bc ; hl = timer now ld a, [hl]