2020-09-11 12:01:24 +02:00
|
|
|
#ifndef _DEF_PLAYER
|
|
|
|
#define _DEF_PLAYER
|
|
|
|
|
2021-01-01 02:22:48 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-09-11 12:01:24 +02:00
|
|
|
#include "vec.h"
|
|
|
|
|
2020-12-21 12:18:55 +01:00
|
|
|
typedef struct Player {
|
2020-09-14 14:37:46 +02:00
|
|
|
Vec pos;
|
2020-12-21 17:50:00 +01:00
|
|
|
Vec spd; /* velocity */
|
2020-09-21 14:52:28 +02:00
|
|
|
Vec hbox; /* the bottom left corner of the player's hitbox */
|
|
|
|
Vec vbox; /* the bottom left corner of the player's visual box */
|
2020-12-27 23:53:34 +01:00
|
|
|
Vec origin; /* the origin of the sprite (offset) */
|
2020-12-23 23:22:02 +01:00
|
|
|
uint grace; /* coyot jump */
|
2021-01-01 02:22:48 +01:00
|
|
|
bool jump_held; /* used to control jump height */
|
2021-01-08 19:03:58 +01:00
|
|
|
bool dead; /* set to true the player will die */
|
2020-09-11 12:01:24 +02:00
|
|
|
} Player;
|
|
|
|
|
2020-09-23 12:19:40 +02:00
|
|
|
#include "level.h"
|
|
|
|
#include "camera.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
2020-12-21 17:50:00 +01:00
|
|
|
void player_move(Player *player, const Level *level);
|
2020-12-27 01:45:58 +01:00
|
|
|
void player_step(Player *player, Input *input, const Level *level, uint step);
|
2020-09-11 18:07:53 +02:00
|
|
|
void player_draw(Player *player, Camera *camera);
|
2021-01-05 16:24:55 +01:00
|
|
|
void player_draw_debug(Player *player, uint step, const Level *level);
|
2020-09-11 12:01:24 +02:00
|
|
|
|
2020-09-11 18:07:53 +02:00
|
|
|
#endif /* _DEF_PLAYER */
|