This might be useful if the game should not be turn-based
#define UI_STATUS_LINE shadow_ui+1
+ ; how often should turns auto-end
+ ; frame timer
+#define TICK_RATE 10
+
.def int OAMDMAFN = 0xFF80
#define WRAM 0xC000
#define WRAM1 0xD000
; code to run when player has moved
player_moved:
- ld de, player
- call act_clear_tact
-
- ld de, player
- call act_set_tact
-
call map_full_draw
call player_end_turn
ret
player_end_turn:
ld a, 1
ld [turn_flag], a
+
+ xor a, a
+ ld [ticks], a
ret
; player should update even in debug mode
call player_update
call player_draw
+ call tick
; if turn flag is 1 -> update actors
ld a, [turn_flag]
ret
+ ; ticks the game
+ ; ends turn if ticks == TICK_RATE
+tick:
+ ld a, [ticks]
+ inc a
+ cp a, TICK_RATE
+ jp z, player_end_turn
+ ld [ticks], a
+ ret
+
; draws a single tile
; inputs:
col_y: .adv 1
col_x: .adv 1
+ticks: .adv 1
+
map_mark_flag: .adv 1
#ifdef DEBUG_CANARY