Commit 3ff5e56a authored by Simon Goller's avatar Simon Goller Committed by neosam

Cargo fmt

parent c95ce74f
......@@ -8,8 +8,8 @@ mod orbitbody;
mod player;
mod position;
mod sprite;
mod thesun;
mod stamina;
mod thesun;
pub use edge::draw_edges_system;
pub use edge::Edge;
......
......@@ -120,36 +120,32 @@ impl gamestate::State for InGameState {
.get_mut(&mut self.world, player)
.unwrap();
match event {
gamestate::Event::KeyDown("w") | gamestate::Event::KeyDown("W") | gamestate::Event::KeyDown("ArrowUp") => {
player_movable.velocity.y = -300.0
}
gamestate::Event::KeyUp("w") | gamestate::Event::KeyUp("W") | gamestate::Event::KeyUp("ArrowUp") => {
player_movable.velocity.y = 0.0
}
gamestate::Event::KeyDown("a") | gamestate::Event::KeyDown("A") | gamestate::Event::KeyDown("ArrowLeft") => {
player_movable.velocity.x = -300.0
}
gamestate::Event::KeyUp("a") | gamestate::Event::KeyUp("A") | gamestate::Event::KeyUp("ArrowLeft") => {
player_movable.velocity.x = 0.0
}
gamestate::Event::KeyDown("s") | gamestate::Event::KeyDown("S") | gamestate::Event::KeyDown("ArrowDown") => {
player_movable.velocity.y = 300.0
}
gamestate::Event::KeyUp("s") | gamestate::Event::KeyUp("S") | gamestate::Event::KeyUp("ArrowDown") => {
player_movable.velocity.y = 0.0
}
gamestate::Event::KeyDown("d") | gamestate::Event::KeyDown("D") | gamestate::Event::KeyDown("ArrowRight") => {
player_movable.velocity.x = 300.0
}
gamestate::Event::KeyUp("d") | gamestate::Event::KeyUp("D") | gamestate::Event::KeyUp("ArrowRight") => {
player_movable.velocity.x = 0.0
}
gamestate::Event::KeyDown("Shift") => {
player_movable.running = true
}
gamestate::Event::KeyUp("Shift") => {
player_movable.running = false
}
gamestate::Event::KeyDown("w")
| gamestate::Event::KeyDown("W")
| gamestate::Event::KeyDown("ArrowUp") => player_movable.velocity.y = -300.0,
gamestate::Event::KeyUp("w")
| gamestate::Event::KeyUp("W")
| gamestate::Event::KeyUp("ArrowUp") => player_movable.velocity.y = 0.0,
gamestate::Event::KeyDown("a")
| gamestate::Event::KeyDown("A")
| gamestate::Event::KeyDown("ArrowLeft") => player_movable.velocity.x = -300.0,
gamestate::Event::KeyUp("a")
| gamestate::Event::KeyUp("A")
| gamestate::Event::KeyUp("ArrowLeft") => player_movable.velocity.x = 0.0,
gamestate::Event::KeyDown("s")
| gamestate::Event::KeyDown("S")
| gamestate::Event::KeyDown("ArrowDown") => player_movable.velocity.y = 300.0,
gamestate::Event::KeyUp("s")
| gamestate::Event::KeyUp("S")
| gamestate::Event::KeyUp("ArrowDown") => player_movable.velocity.y = 0.0,
gamestate::Event::KeyDown("d")
| gamestate::Event::KeyDown("D")
| gamestate::Event::KeyDown("ArrowRight") => player_movable.velocity.x = 300.0,
gamestate::Event::KeyUp("d")
| gamestate::Event::KeyUp("D")
| gamestate::Event::KeyUp("ArrowRight") => player_movable.velocity.x = 0.0,
gamestate::Event::KeyDown("Shift") => player_movable.running = true,
gamestate::Event::KeyUp("Shift") => player_movable.running = false,
_ => (),
}
......
......@@ -15,10 +15,10 @@ pub use level::draw_level_layer_system;
pub use moving::{move_camera_to_player_system, move_movable_system};
pub use player::{
player_sanity_check_system, sanity_goes_up_and_down_system, update_sanity_bar_system,
update_stamina_bar_system
update_stamina_bar_system,
};
pub use sprite::draw_sprites_system;
pub use stamina::{stamina_regeneration_system, empty_stamina_running_system};
pub use stamina::{empty_stamina_running_system, stamina_regeneration_system};
pub use tmp_stationary_obstacles::{
draw_tmp_stationary_obstacles_barrier_system, reduce_sanity_obstacle_system,
};
......@@ -49,8 +49,14 @@ pub fn update_stamina_bar(
)
.unwrap();
stamina_bar
.style().set_property(
"display", if stamina.progress.relative_value() == 1.0 { "none" } else { "block" }
.style()
.set_property(
"display",
if stamina.progress.relative_value() == 1.0 {
"none"
} else {
"block"
},
)
.unwrap();
}
......
use crate::components;
use crate::resources;
......@@ -8,7 +7,9 @@ pub fn stamina_regeneration(
#[resource] clock: &resources::Clock,
stamina: &mut components::Stamina,
) {
stamina.progress.modify(stamina.regeneration * clock.frame_delta());
stamina
.progress
.modify(stamina.regeneration * clock.frame_delta());
}
#[legion::system(for_each)]
......@@ -26,4 +27,4 @@ pub fn empty_stamina_running(
if stamina.progress.value == 0.0 {
movalbe.running = false;
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment