Add flipper logic
This commit is contained in:
parent
97449cbc44
commit
da3b52e395
@ -147,6 +147,13 @@ pub fn update_player_movement(
|
|||||||
// Only do this if the mouse is far enough away
|
// Only do this if the mouse is far enough away
|
||||||
let player_stunned = game_core.player.stun_timer > 0.0;
|
let player_stunned = game_core.player.stun_timer > 0.0;
|
||||||
let mut player_real_movement = game_core.player.direction * speed_multiplier;
|
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
|
if raw_movement_direction.distance_to(Vector2::zero()) > game_core.player.size.y / 2.0
|
||||||
&& !game_core.player.is_stunned()
|
&& !game_core.player.is_stunned()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user