From ad7bf888bb19886757957156a8eb8afa10bb914d Mon Sep 17 00:00:00 2001 From: unfa Date: Sun, 14 Jun 2020 00:47:26 +0200 Subject: [PATCH] Player walk direction --- Player.gd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Player.gd b/Player.gd index e379163..6a47c1a 100644 --- a/Player.gd +++ b/Player.gd @@ -16,7 +16,16 @@ func gravity(): func walk(): walkDirection = Vector2.ZERO - #if input + if Input.is_action_pressed("MoveForward"): + walkDirection.x += 1 + if Input.is_action_pressed("MoveBack"): + walkDirection.x -= 1 + if Input.is_action_pressed("MoveRight"): + walkDirection.y += 1 + if Input.is_action_pressed("MoveLeft"): + walkDirection.y -= 1 + + print("Player walkDirection: ", walkDirection) func motion(delta): self.move_and_slide(velocity * delta, Vector3.UP)