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),
// Diagonals
VirtualKeyCode::Numpad9 | VirtualKeyCode::Key9 | VirtualKeyCode::Y => {
try_move_player(1, -1, &mut gs.ecs)
}
VirtualKeyCode::Numpad7 | VirtualKeyCode::Key7 | VirtualKeyCode::U => {
try_move_player(-1, -1, &mut gs.ecs)
}
VirtualKeyCode::Numpad3 | VirtualKeyCode::Key3 | VirtualKeyCode::N => {
try_move_player(1, 1, &mut gs.ecs)
}
VirtualKeyCode::Numpad1 | VirtualKeyCode::Key1 | VirtualKeyCode::B => {
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::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::Numpad1
| VirtualKeyCode::Key1
| VirtualKeyCode::B
| VirtualKeyCode::A => try_move_player(-1, 1, &mut gs.ecs),
// 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
VirtualKeyCode::Period => {