refactor: split player_move and decompose handle_input
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Iaac0cda778dd541eb34980f3e902ca726a6a6964
This commit is contained in:
parent
22ab6fc6eb
commit
ee116ef33f
3 changed files with 228 additions and 230 deletions
|
|
@ -6,8 +6,11 @@
|
|||
// Initialize player at position
|
||||
void player_init(Player *p, int x, int y);
|
||||
|
||||
// Move player, return 1 if moved/attacked, 0 if blocked
|
||||
int player_move(Player *p, int dx, int dy, Map *map, Enemy *enemies, int enemy_count);
|
||||
// Move player to (x+dx, y+dy); returns 1 if moved, 0 if blocked
|
||||
int player_move(Player *p, int dx, int dy, Map *map);
|
||||
|
||||
// Find a living enemy at tile (x, y); returns NULL if none
|
||||
Enemy *player_find_enemy_at(Enemy *enemies, int count, int x, int y);
|
||||
|
||||
// Player attacks enemy (deal damage)
|
||||
void player_attack(Player *p, Enemy *e);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue