.def int PLAYER_TILE_IDLE2 = 0x14
.def int PLAYER_TILE_IDLE3 = 0x24
+ ; init the player
+ ; inputs:
+ ; hl: pointer to player memory
+player_init:
+ xor a, a
+ ; y
+ ld [hl+], a
+ ; x
+ ld [hl+], a
+ ; flags
+ ld [hl+], a
+
+ ; default hp max
+ ld a, PLAYER_DEFAULT_HP
+ ld [hl+], a ; hp
+ ld [hl+], a ; hp max
+
+ ; default mp max
+ ld a, PLAYER_DEFAULT_MP
+ ld [hl+], a ; mp
+ ld [hl+], a ; mp max
+
+ ; default def
+ ld a, PLAYER_DEFAULT_DEF
+ ld [hl+], a
+
+ ; default atk
+ ld a, PLAYER_DEFAULT_ATK
+ ld [hl+], a
+
+ ret
+
; update the player
; players do not behave like regular actors
; and are not allocate to the regular
actor_table: .adv ACTORS_MAX * actor_size
+#define PLAYER_DEFAULT_HP 3
+#define PLAYER_DEFAULT_MP 3
+#define PLAYER_DEFAULT_DEF 1
+#define PLAYER_DEFAULT_ATK 1
+
; struct player
.se 0
.de player_y, 1
.de player_x, 1
.de player_flags, 1
+
+ ; player stats
+.de player_hp, 1
+.de player_hp_max, 1
+.de player_mp, 1
+.de player_mp_max, 1
+.de player_def, 1
+.de player_atk, 1
+
.de player_size, 0
player: .adv player_size