refactor: clippy

Former-commit-id: 612296154780f9fc8500cfb18e77a7677a80f43b
This commit is contained in:
Muhammad Nauman Raza 2023-12-07 17:44:17 +00:00
parent 66bed01926
commit 32a66ec64f
Signed by: devraza
GPG key ID: 91EAD6081011574B

View file

@ -41,15 +41,11 @@ pub fn movement(
// Initialise the movement distance variable (to bring it into scope) // Initialise the movement distance variable (to bring it into scope)
let mut movement_distance: f32 = 0.; let mut movement_distance: f32 = 0.;
let mut dashing = false; if keys.just_pressed(KeyCode::Space) && player.stamina >= 0.3 {
player.is_dashing = true;
if keys.just_pressed(KeyCode::Space) {
if player.stamina >= 0.3 {
dashing = true;
player.stamina -= 0.3; player.stamina -= 0.3;
movement_distance = 256.; movement_distance = 256.;
} }
}
if keys.pressed(KeyCode::Left) { if keys.pressed(KeyCode::Left) {
transform.rotation = Quat::from_rotation_z((90_f32).to_radians()); transform.rotation = Quat::from_rotation_z((90_f32).to_radians());
@ -70,11 +66,10 @@ pub fn movement(
// Get the player's *forward* vector // Get the player's *forward* vector
let movement_direction = transform.rotation * Vec3::Y; let movement_direction = transform.rotation * Vec3::Y;
if dashing == false { if !player.is_dashing {
movement_distance = movement_factor * player.movement_speed * time.delta_seconds(); movement_distance = movement_factor * player.movement_speed * time.delta_seconds();
// Change the player rotation around the Z-axis only if not dashing // Change the player rotation around the Z-axis only if not dashing
transform.rotate_z(rotation_factor * player.rotation_speed * time.delta_seconds()); transform.rotate_z(rotation_factor * player.rotation_speed * time.delta_seconds());
} else {
} }
// Update the player translation with the translation // Update the player translation with the translation