From e725ba2eba53d09954949337ad0f61c63bbfe9c7 Mon Sep 17 00:00:00 2001 From: JP Stringham Date: Sat, 7 Feb 2026 13:27:54 -0500 Subject: [PATCH] arrow key support --- src/main.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 47f9fe1..e61fa98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -142,15 +142,19 @@ fn levelload( fn gameloop(keyb: Res>, 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; }