From: Lukas Krickl Date: Wed, 21 Jan 2026 04:39:32 +0000 (+0100) Subject: player: settarget now also happens in the init call X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=64dcceb6b8a7058efd2faefd5421d68fd1d08901;p=gbrg%2F.git player: settarget now also happens in the init call --- diff --git a/src/player.s b/src/player.s index 5310d11..69f7a84 100644 --- a/src/player.s +++ b/src/player.s @@ -1,6 +1,20 @@ #define PLAYER_TARGET_CURSOR 0x86 + ; sets player target positon + ; inputs: + ; $1: inc/dec for y position (e.g. 0, 1, -1) + ; $2: inc/dec for x position (e.g. 0, 1, -1) +#macro _player_set_target + ld a, [player+act_pos_y] + add a, $1 & 0xFF + ld [player_target_y], a + + ld a, [player+act_pos_x] + add a, $2 & 0xFF + ld [player_target_x], a +#endmacro + ; sets up the player actor player_init: ld a, 2 @@ -58,7 +72,8 @@ player_init: ld [player+act_hp], a ld a, c ld [player+act_hp+1], a - + + _player_set_target -1, 0 ret @@ -123,19 +138,6 @@ player_draw: ret - ; sets player target positon - ; inputs: - ; $1: inc/dec for y position (e.g. 0, 1, -1) - ; $2: inc/dec for x position (e.g. 0, 1, -1) -#macro _player_set_target - ld a, [player+act_pos_y] - add a, $1 & 0xFF - ld [player_target_y], a - - ld a, [player+act_pos_x] - add a, $2 & 0xFF - ld [player_target_x], a -#endmacro ; player attack call player_attack: