Add additional set of controls for diagonals

This commit is contained in:
Timothy Warren 2021-11-18 10:48:14 -05:00
parent e0f3b7c255
commit b9e499b421

View File

@ -163,21 +163,30 @@ pub fn player_input(gs: &mut State, ctx: &mut Rltk) -> RunState {
| VirtualKeyCode::J => try_move_player(0, 1, &mut gs.ecs), | VirtualKeyCode::J => try_move_player(0, 1, &mut gs.ecs),
// Diagonals // Diagonals
VirtualKeyCode::Numpad9 | VirtualKeyCode::Key9 | VirtualKeyCode::Y => { VirtualKeyCode::Numpad9
try_move_player(1, -1, &mut gs.ecs) | VirtualKeyCode::Key9
} | VirtualKeyCode::Y
VirtualKeyCode::Numpad7 | VirtualKeyCode::Key7 | VirtualKeyCode::U => { | VirtualKeyCode::W => try_move_player(1, -1, &mut gs.ecs),
try_move_player(-1, -1, &mut gs.ecs)
} VirtualKeyCode::Numpad7
VirtualKeyCode::Numpad3 | VirtualKeyCode::Key3 | VirtualKeyCode::N => { | VirtualKeyCode::Key7
try_move_player(1, 1, &mut gs.ecs) | VirtualKeyCode::U
} | VirtualKeyCode::Q => try_move_player(-1, -1, &mut gs.ecs),
VirtualKeyCode::Numpad1 | VirtualKeyCode::Key1 | VirtualKeyCode::B => {
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::Numpad1
| VirtualKeyCode::Key1
| VirtualKeyCode::B
| VirtualKeyCode::A => try_move_player(-1, 1, &mut gs.ecs),
// Skip Turn // Skip Turn
VirtualKeyCode::Numpad5 | VirtualKeyCode::Key5 | VirtualKeyCode::Space => return skip_turn(&mut gs.ecs), VirtualKeyCode::Numpad5 | VirtualKeyCode::Key5 | VirtualKeyCode::Space => {
return skip_turn(&mut gs.ecs)
}
// Level changes // Level changes
VirtualKeyCode::Period => { VirtualKeyCode::Period => {