#ifndef PLAYER_H #define PLAYER_H #include "twn_game_api.h" struct world; enum player_action { PLAYER_ACTION_GROUND, PLAYER_ACTION_FALL, PLAYER_ACTION_JUMP, }; struct player { struct world *world; /* visual */ float sprite_w; float sprite_h; /* body */ t_frect rect; /* state */ enum player_action action; /* physics */ t_frect collider_x; t_frect collider_y; int collider_thickness; float dx; float dy; float max_dx; float run_horizontal_speed; float horizontal_damping; float current_gravity_multiplier; float terminal_velocity; /* jumping */ float jump_force_initial; float jump_force_increase; /* aka "jump power", increment of dy per tick */ int jump_air_ticks; int jump_air_timer; int jump_coyote_ticks; int jump_coyote_timer; int jump_buffer_ticks; int jump_buffer_timer; /* gravity multipliers */ float jump_default_multiplier; float jump_boosted_multiplier; float jump_corner_correction_offset; /* from center */ }; struct player *player_create(struct world *world); void player_destroy(struct player *player); void player_calc(struct player *player); #endif