Add flipper logic

This commit is contained in:
Evan Pratten 2021-04-25 13:25:05 -04:00
parent 97449cbc44
commit da3b52e395

View File

@ -147,6 +147,13 @@ pub fn update_player_movement(
// Only do this if the mouse is far enough away
let player_stunned = game_core.player.stun_timer > 0.0;
let mut player_real_movement = game_core.player.direction * speed_multiplier;
// Handle the player wearing flippers
if game_core.player.inventory.flippers.is_some() {
player_real_movement *= game_core.player.inventory.flippers.as_ref().unwrap().speed_increase;
}
// Handle movement and collisions
if raw_movement_direction.distance_to(Vector2::zero()) > game_core.player.size.y / 2.0
&& !game_core.player.is_stunned()
{