From 7ecc87b775050cc6590347914310ce736e91b6aa Mon Sep 17 00:00:00 2001 From: Pretham Muthappa <98420696+PrethamMuthappa@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:13:37 +0530 Subject: [PATCH] add: WASD movement added --- .../dinosaurexploder/controller/DinosaurController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/dinosaur/dinosaurexploder/controller/DinosaurController.java b/src/main/java/com/dinosaur/dinosaurexploder/controller/DinosaurController.java index 4daf896..9aabacb 100644 --- a/src/main/java/com/dinosaur/dinosaurexploder/controller/DinosaurController.java +++ b/src/main/java/com/dinosaur/dinosaurexploder/controller/DinosaurController.java @@ -54,6 +54,12 @@ public void initInput() { onKey(KeyCode.RIGHT, () -> player.getComponent(PlayerComponent.class).moveRight()); onKeyDown(KeyCode.SPACE,() -> player.getComponent(PlayerComponent.class).shoot()); + + onKey(KeyCode.W, () -> player.getComponent(PlayerComponent.class).moveUp()); + onKey(KeyCode.S, () -> player.getComponent(PlayerComponent.class).moveDown()); + onKey(KeyCode.A, () -> player.getComponent(PlayerComponent.class).moveLeft()); + onKey(KeyCode.D, () -> player.getComponent(PlayerComponent.class).moveRight()); + } /** * Summary :