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 None => return RunState::AwaitingInput, // Nothing happened
Some(key) => match key { Some(key) => match key {
// Cardinal directions // 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::Up
| VirtualKeyCode::Numpad8 | VirtualKeyCode::Numpad8
| VirtualKeyCode::Key8 | VirtualKeyCode::Key8
@ -162,27 +152,37 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState {
| VirtualKeyCode::Key2 | VirtualKeyCode::Key2
| VirtualKeyCode::J => try_move_player(0, 1, &mut gs.ecs), | VirtualKeyCode::J => try_move_player(0, 1, &mut gs.ecs),
// Diagonals VirtualKeyCode::Left
VirtualKeyCode::Numpad9 | VirtualKeyCode::Numpad4
| VirtualKeyCode::Key9 | VirtualKeyCode::Key4
| VirtualKeyCode::Y | VirtualKeyCode::H => try_move_player(-1, 0, &mut gs.ecs),
| VirtualKeyCode::W => try_move_player(1, -1, &mut gs.ecs),
VirtualKeyCode::Right
| VirtualKeyCode::Numpad6
| VirtualKeyCode::Key6
| VirtualKeyCode::L => try_move_player(1, 0, &mut gs.ecs),
// Diagonals
VirtualKeyCode::Numpad7 VirtualKeyCode::Numpad7
| VirtualKeyCode::Key7 | VirtualKeyCode::Key7
| VirtualKeyCode::U | VirtualKeyCode::U
| VirtualKeyCode::Q => try_move_player(-1, -1, &mut gs.ecs), | VirtualKeyCode::Q => try_move_player(-1, -1, &mut gs.ecs),
VirtualKeyCode::Numpad3 VirtualKeyCode::Numpad9
| VirtualKeyCode::Key3 | VirtualKeyCode::Key9
| VirtualKeyCode::N | VirtualKeyCode::Y
| VirtualKeyCode::S => try_move_player(1, 1, &mut gs.ecs), | VirtualKeyCode::W => try_move_player(1, -1, &mut gs.ecs),
VirtualKeyCode::Numpad1 VirtualKeyCode::Numpad1
| VirtualKeyCode::Key1 | VirtualKeyCode::Key1
| VirtualKeyCode::B | VirtualKeyCode::B
| VirtualKeyCode::A => try_move_player(-1, 1, &mut gs.ecs), | 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 // Skip Turn
VirtualKeyCode::Numpad5 | VirtualKeyCode::Key5 | VirtualKeyCode::Space => { VirtualKeyCode::Numpad5 | VirtualKeyCode::Key5 | VirtualKeyCode::Space => {
return skip_turn(&mut gs.ecs) return skip_turn(&mut gs.ecs)