Character is moving faster in the diagonal directions than horizontal/vertical
A classical bug, caused by the following code (src/states/ingame.rs:95
):
fn event(&mut self, event: gamestate::Event) -> gamestate::Transition {
use legion::IntoQuery;
let player = self.resources.get::<resources::Player>().unwrap().0.clone();
let player_movable = <&mut components::Movable>::query()
.get_mut(&mut self.world, player)
.unwrap();
match event {
gamestate::Event::KeyDown("w") => player_movable.velocity.y = -50.0,
gamestate::Event::KeyUp("w") => player_movable.velocity.y = 0.0,
gamestate::Event::KeyDown("a") => player_movable.velocity.x = -50.0,
gamestate::Event::KeyUp("a") => player_movable.velocity.x = 0.0,
gamestate::Event::KeyDown("s") => player_movable.velocity.y = 50.0,
gamestate::Event::KeyUp("s") => player_movable.velocity.y = 0.0,
gamestate::Event::KeyDown("d") => player_movable.velocity.x = 50.0,
gamestate::Event::KeyUp("d") => player_movable.velocity.x = 0.0,
_ => (),
}
gamestate::Transition::Keep
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information