blob: df32bc687e10fadb426f12b3e02c8c3ff51553df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
|