Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • E Engel Simulator 2020
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Engel Simulator 2020
  • Engel Simulator 2020
  • Issues
  • #19

Closed
Open
Created Dec 25, 2020 by Rahix@rahix🦀Owner

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
Assignee
Assign to
Time tracking