mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-01-03 23:43:42 +01:00
43 lines
1.2 KiB
C
43 lines
1.2 KiB
C
#ifndef PLAYER_H
|
|
#define PLAYER_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "mapstruct.h"
|
|
#include "memory.h"
|
|
|
|
/* The direction where the player is going to. */
|
|
typedef enum {
|
|
D_UP,
|
|
D_DOWN,
|
|
D_LEFT,
|
|
D_RIGHT
|
|
} Direction;
|
|
|
|
/* Struct that define player parameters */
|
|
typedef struct {
|
|
unsigned short int x, y; /* The position of the player */
|
|
unsigned char px, py; /* The position of the player on screen */
|
|
unsigned short int life; /* How many lives the player still has between 0
|
|
* and 100. */
|
|
} Player;
|
|
|
|
/* Draws the player player. This function should be called after drawing the
|
|
* map! */
|
|
void player_draw(Player *player);
|
|
|
|
/* Move the player player in the direction direction. */
|
|
void player_move(Map *map_level, Player *player, Direction direction);
|
|
|
|
/* (Mibi88) TODO: Describe this function please, I've no idea what she's for! */
|
|
void player_action(Player *player);
|
|
|
|
/* Check if the player is in collision with the map or a NPC. */
|
|
bool player_collision(Map *map_level, Player *player, Direction direction);
|
|
|
|
/* Fix the position of the player so that he's not a bit inside of a hard block
|
|
* after a collision. */
|
|
void player_fix_position(Player *player, bool fix_x, bool fix_y);
|
|
|
|
#endif
|
|
|