diff options
Diffstat (limited to 'player.h')
-rw-r--r-- | player.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/player.h b/player.h new file mode 100644 index 0000000..df32bc6 --- /dev/null +++ b/player.h @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* player.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: kdx <kdx @student.42angouleme.fr +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/10/09 08:29:41 by kdx #+# #+# */ +/* Updated: 2022/10/14 14:36:55 by kdx ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef PLAYER_H +# define PLAYER_H +# include "sily.h" +# include "map.h" +# include "badeline.h" +# define PLAYER_FRICTION 0.02 +# define PLAYER_ACCELERATION 0.4 +# define PLAYER_THRUSTER 0.6 +# define PLAYER_GRAVITY 0.2 +# define PLAYER_INVINCIBLE 60 + +typedef struct s_player { + int invincible; + double old_pos[2]; + double pos[2]; + double vel[2]; +} t_player; + +typedef struct s_game t_game; + +void player_init(t_player *player, double x, double y); +void player_update(t_sily *sily, t_player *player); +void player_erase(t_sily *sily, double pos[2]); +void player_draw(t_sily *sily, t_player *player); +int player_collide(t_map *map, double x, double y, int v); +void player_collect(t_game *game, t_player *player, t_map *map); +void player_collide_exit(t_sily *sily, t_player *player, t_map *map); +bool player_collide_badeline(t_player *player, t_badeline *bdl); + +#endif |