yet another api rework, removal of integer types in public api, optionals at the end, some cleaning
This commit is contained in:
@@ -20,19 +20,19 @@ static void update_timers(Player *player) {
|
||||
static void input_move(Player *player) {
|
||||
/* apply horizontal damping when the player stops moving */
|
||||
/* in other words, make it decelerate to a standstill */
|
||||
if (!input_is_action_pressed("player_left") &&
|
||||
!input_is_action_pressed("player_right"))
|
||||
if (!input_action_pressed("player_left") &&
|
||||
!input_action_pressed("player_right"))
|
||||
{
|
||||
player->dx *= player->horizontal_damping;
|
||||
}
|
||||
|
||||
int input_dir = 0;
|
||||
if (input_is_action_pressed("player_left"))
|
||||
if (input_action_pressed("player_left"))
|
||||
input_dir = -1;
|
||||
if (input_is_action_pressed("player_right"))
|
||||
if (input_action_pressed("player_right"))
|
||||
input_dir = 1;
|
||||
if (input_is_action_pressed("player_left") &&
|
||||
input_is_action_pressed("player_right"))
|
||||
if (input_action_pressed("player_left") &&
|
||||
input_action_pressed("player_right"))
|
||||
input_dir = 0;
|
||||
|
||||
player->dx += (float)input_dir * player->run_horizontal_speed;
|
||||
@@ -56,7 +56,7 @@ static void jump(Player *player) {
|
||||
static void input_jump(Player *player) {
|
||||
player->current_gravity_multiplier = player->jump_default_multiplier;
|
||||
|
||||
if (input_is_action_just_pressed("player_jump")) {
|
||||
if (input_action_just_pressed("player_jump")) {
|
||||
player->jump_air_timer = 0;
|
||||
player->jump_buffer_timer = player->jump_buffer_ticks;
|
||||
|
||||
@@ -65,7 +65,7 @@ static void input_jump(Player *player) {
|
||||
}
|
||||
}
|
||||
|
||||
if (input_is_action_pressed("player_jump")) {
|
||||
if (input_action_pressed("player_jump")) {
|
||||
if (player->action != PLAYER_ACTION_GROUND && player->jump_air_timer > 0) {
|
||||
player->current_gravity_multiplier = player->jump_boosted_multiplier;
|
||||
player->dy += player->jump_force_increase;
|
||||
@@ -147,7 +147,7 @@ static bool corner_correct(Player *player, Rect collision) {
|
||||
|
||||
static void calc_collisions_x(Player *player) {
|
||||
Rect collision;
|
||||
bool is_colliding = world_find_intersect_frect(player->world, player->collider_x, &collision);
|
||||
bool is_colliding = world_find_rect_intersects(player->world, player->collider_x, &collision);
|
||||
if (!is_colliding) return;
|
||||
|
||||
float player_center_x = player->collider_x.x + (player->collider_x.w / 2);
|
||||
@@ -164,7 +164,7 @@ static void calc_collisions_x(Player *player) {
|
||||
|
||||
static void calc_collisions_y(Player *player) {
|
||||
Rect collision;
|
||||
bool is_colliding = world_find_intersect_frect(player->world, player->collider_y, &collision);
|
||||
bool is_colliding = world_find_rect_intersects(player->world, player->collider_y, &collision);
|
||||
if (!is_colliding) return;
|
||||
|
||||
float player_center_y = player->collider_y.y + (player->collider_y.h / 2);
|
||||
|
Reference in New Issue
Block a user