Collab_RPG/src/player.h
2024-07-31 20:10:45 +02:00

70 lines
1.8 KiB
C

#ifndef PLAYER_H
#define PLAYER_H
#include "config.h"
#include "game.h"
#include "memory.h"
#include <stdbool.h>
typedef struct {
const char *name;
bopti_image_t *face;
} Face;
#define FACES 4
/* Structure 'Player' has been moved to game.h */
/* to avoid circular references between map.h, game.h and player.h */
/* only methods propotypes are now in dedicated header files */
/* player_draw()
*
* Draws the player. This function should be called after drawing the
* map!
* game: The game struct which contains the player struct used.
*/
void player_draw(Game *game);
/* player_move()
*
* Move the player in a direction.
* game: The game struct.
* direction: The direction to move the player in.
*/
void player_move(Game *game, Direction direction);
/*Tries to do an action based on previously set flags (called if the shift key
* is pressed)*/
void player_action(Game *game);
/* player_collision()
*
* Check if the player is in collision with the map or a NPC. Checkpos is used
* to check the axis where the player is not moving.
* game: The game struct.
* direction: The direction the player is moving in.
* nomov_axis_check: The axis that isn't changed by this movement.
*/
bool player_collision(Game *game, Direction direction,
Checkpos nomov_axis_check);
/* player_fix_position()
*
* Fix the position of the player so that he's not a bit inside of a hard block
* after a collision.
* game: The game struct.
* fix_x: If we should fix the position on the X axis.
* fix_y: If we should fix the position on the Y axis.
*/
void player_fix_position(Game *game, bool fix_x, bool fix_y);
/* player_damage()
*
* Apply damage to player
* game: The game struct.
* amount: The amount of damage to apply.
*/
void player_damage(Game *game, int amount);
#endif