player: settarget now also happens in the init call
authorLukas Krickl <lukas@krickl.dev>
Wed, 21 Jan 2026 04:39:32 +0000 (05:39 +0100)
committerLukas Krickl <lukas@krickl.dev>
Wed, 21 Jan 2026 04:39:32 +0000 (05:39 +0100)
src/player.s

index 5310d11dd49df6a109315c8fbf5b7683fb1a075c..69f7a84d3dd8763b34cde3796b84120e3239ea69 100644 (file)
@@ -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: