hotfix: switch to a non-broken, blink-style of dash
Former-commit-id: 8b8904b5dd130fa7f1d894eae2432f230292ef11
This commit is contained in:
parent
91b6698813
commit
66bed01926
1 changed files with 15 additions and 24 deletions
|
@ -38,22 +38,19 @@ pub fn movement(
|
||||||
rotation_factor -= 1.;
|
rotation_factor -= 1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
if keys.pressed(KeyCode::Space) && player.is_dashing == false {
|
// Initialise the movement distance variable (to bring it into scope)
|
||||||
player.is_dashing = true;
|
let mut movement_distance: f32 = 0.;
|
||||||
movement_factor = 5.;
|
|
||||||
if player.stamina > 0. {
|
let mut dashing = false;
|
||||||
player.stamina -= 0.025;
|
|
||||||
}
|
if keys.just_pressed(KeyCode::Space) {
|
||||||
if player.stamina < 0. {
|
if player.stamina >= 0.3 {
|
||||||
player.stamina = 0.;
|
dashing = true;
|
||||||
|
player.stamina -= 0.3;
|
||||||
|
movement_distance = 256.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Initialise the movement distance variable (to bring it into scope)
|
|
||||||
let movement_distance: f32;
|
|
||||||
|
|
||||||
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());
|
||||||
movement_factor = 1.;
|
movement_factor = 1.;
|
||||||
|
@ -73,13 +70,11 @@ 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 player.is_dashing == true {
|
if dashing == false {
|
||||||
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 {
|
} else {
|
||||||
movement_distance = player.stamina * movement_factor * player.movement_speed * time.delta_seconds();
|
|
||||||
player.is_dashing = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the player translation with the translation
|
// Update the player translation with the translation
|
||||||
|
@ -104,10 +99,6 @@ pub fn player_regen(mut player_query: Query<&mut Player, With<Player>>, time: Re
|
||||||
let mut player = player_query.single_mut();
|
let mut player = player_query.single_mut();
|
||||||
println!("{}", player.stamina);
|
println!("{}", player.stamina);
|
||||||
if player.stamina < 1. {
|
if player.stamina < 1. {
|
||||||
if player.stamina < 0. {
|
player.stamina += 0.1 * time.delta_seconds();
|
||||||
player.stamina += 0.1 * time.delta_seconds();
|
|
||||||
} else {
|
|
||||||
player.stamina += 0.1 * time.delta_seconds();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue