From 950c0a3ef13e020712b05a3f09b51bfbb19300e5 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 18 Nov 2021 10:56:51 -0500 Subject: [PATCH] Arrange key mappings in a bit more intuitive order --- src/player.rs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/player.rs b/src/player.rs index ccb2d4e..908fde9 100644 --- a/src/player.rs +++ b/src/player.rs @@ -142,16 +142,6 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState { None => return RunState::AwaitingInput, // Nothing happened Some(key) => match key { // Cardinal directions - VirtualKeyCode::Left - | VirtualKeyCode::Numpad4 - | VirtualKeyCode::Key4 - | VirtualKeyCode::H => try_move_player(-1, 0, &mut gs.ecs), - - VirtualKeyCode::Right - | VirtualKeyCode::Numpad6 - | VirtualKeyCode::Key6 - | VirtualKeyCode::L => try_move_player(1, 0, &mut gs.ecs), - VirtualKeyCode::Up | VirtualKeyCode::Numpad8 | VirtualKeyCode::Key8 @@ -162,27 +152,37 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState { | VirtualKeyCode::Key2 | VirtualKeyCode::J => try_move_player(0, 1, &mut gs.ecs), - // Diagonals - VirtualKeyCode::Numpad9 - | VirtualKeyCode::Key9 - | VirtualKeyCode::Y - | VirtualKeyCode::W => try_move_player(1, -1, &mut gs.ecs), + VirtualKeyCode::Left + | VirtualKeyCode::Numpad4 + | VirtualKeyCode::Key4 + | VirtualKeyCode::H => try_move_player(-1, 0, &mut gs.ecs), + VirtualKeyCode::Right + | VirtualKeyCode::Numpad6 + | VirtualKeyCode::Key6 + | VirtualKeyCode::L => try_move_player(1, 0, &mut gs.ecs), + + // Diagonals VirtualKeyCode::Numpad7 | VirtualKeyCode::Key7 | VirtualKeyCode::U | VirtualKeyCode::Q => try_move_player(-1, -1, &mut gs.ecs), - VirtualKeyCode::Numpad3 - | VirtualKeyCode::Key3 - | VirtualKeyCode::N - | VirtualKeyCode::S => try_move_player(1, 1, &mut gs.ecs), + VirtualKeyCode::Numpad9 + | VirtualKeyCode::Key9 + | VirtualKeyCode::Y + | VirtualKeyCode::W => try_move_player(1, -1, &mut gs.ecs), VirtualKeyCode::Numpad1 | VirtualKeyCode::Key1 | VirtualKeyCode::B | VirtualKeyCode::A => try_move_player(-1, 1, &mut gs.ecs), + VirtualKeyCode::Numpad3 + | VirtualKeyCode::Key3 + | VirtualKeyCode::N + | VirtualKeyCode::S => try_move_player(1, 1, &mut gs.ecs), + // Skip Turn VirtualKeyCode::Numpad5 | VirtualKeyCode::Key5 | VirtualKeyCode::Space => { return skip_turn(&mut gs.ecs)