; updates the special player actor
player_update:
call scroll_center_player
+
+ call move_cursor
+ ret
+
+ ; moves the player cursor
+ ; does not move out of bounds
+move_cursor:
+ ld b, BTNDOWN
+ input_held
+ jr z, @not_down REL
+ ld a, [player+act_pos_y]
+ inc a
+ ld [player+act_pos_y], a
+@not_down:
+
+ ld b, BTNUP
+ input_held
+ jr z, @not_up REL
+ ld a, [player+act_pos_y]
+ dec a
+ ld [player+act_pos_y], a
+@not_up:
+
+ ld b, BTNLEFT
+ input_held
+ jr z, @not_left REL
+ ld a, [player+act_pos_x]
+ dec a
+ ld [player+act_pos_x], a
+@not_left:
+
+ ld b, BTNRIGHT
+ input_held
+ jr z, @not_right REL
+ ld a, [player+act_pos_x]
+ inc a
+ ld [player+act_pos_x], a
+@not_right:
ret
; draws player at current location
ld a, [player+act_pos_y]
add a, OBJ_OFF_Y
- sub a, b
+ sub a, b ; - scroll y
; store y for second obj
ld [tmp_y], a
; calculate x pos
ld a, [scroll_x]
ld b, a
- sub a, b
ld a, [player+act_pos_x]
add a, OBJ_OFF_X
+ sub a, b ; - scroll x
; store x for second obj
ld [tmp_x], a