Arrange key mappings in a bit more intuitive order

This commit is contained in:
Timothy Warren 2021-11-18 10:56:51 -05:00
parent b9e499b421
commit 950c0a3ef1

View File

@ -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)