diff --git a/src/player.c b/src/player.c index 52d53cc..410189a 100644 --- a/src/player.c +++ b/src/player.c @@ -13,8 +13,8 @@ /* TODO: Determine FRICTION and ACCELERATION from UPS. */ #define MAX_SPD (128 * PXS) -#define FRICTION 0.99 -#define ACCELERATION (int)(MAX_SPD * (1 - FRICTION)) +#define FRICTION 0.01 +#define ACCELERATION (int)(MAX_SPD * FRICTION) #define GRAVITY PXS #define FAST_FALL_FACTOR 3 #define JUMP_SPD (-128 * PXS) @@ -130,7 +130,7 @@ void player_step(Player *player, Input *input, const Level *level, uint step) { /* other keys */ bool k_jump = INPUT_DOWN(K_JUMP); int xacc = move.x * player->vars.acceleration; /* calculate horizontal acceleration */ - player->spd.x *= player->vars.friction; /* apply horizontal friction */ + player->spd.x *= 1 - player->vars.friction; /* apply horizontal friction */ player->spd.x += xacc; /* apply horizontal acceleration */ /* apply gravity */ if (player->spd.y < 0 && !player->jump_held) { diff --git a/src/player_modifiers.c b/src/player_modifiers.c index a4e03c5..f8d7c8b 100644 --- a/src/player_modifiers.c +++ b/src/player_modifiers.c @@ -2,12 +2,11 @@ #include "player.h" void player_mod_ice(Player *player) { - player->vars.acceleration *= 2; - float *friction = &player->vars.friction; - *friction = 1 - ((1 - *friction) / 2); + player->vars.acceleration /= 4; + player->vars.friction /= 4; } void player_mod_glue(Player *player) { player->vars.acceleration = 0; - player->vars.friction = 0; + player->vars.friction = 1; }