arrow key support

This commit is contained in:
JP Stringham
2026-02-07 13:27:54 -05:00
parent 53533cafa2
commit e725ba2eba

View File

@@ -142,15 +142,19 @@ fn levelload(
fn gameloop(keyb: Res<ButtonInput<KeyCode>>, mut player: Single<(&mut Player, &mut Transform)>) {
let mut dir = IVec2::ZERO;
if keyb.pressed(KeyCode::KeyA) {
dir.x = -1;
} else if keyb.pressed(KeyCode::KeyD) {
dir.x = 1;
if keyb.pressed(KeyCode::KeyA) || keyb.pressed(KeyCode::ArrowLeft) {
dir.x += -1;
}
if keyb.pressed(KeyCode::KeyW) {
dir.y = 1;
} else if keyb.pressed(KeyCode::KeyS) {
if keyb.pressed(KeyCode::KeyD) || keyb.pressed(KeyCode::ArrowRight) {
dir.x += 1;
}
if keyb.pressed(KeyCode::KeyW) || keyb.pressed(KeyCode::ArrowUp) {
dir.y += 1;
}
if keyb.pressed(KeyCode::KeyS) || keyb.pressed(KeyCode::ArrowDown) {
dir.y = -1;
}