We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a757f3a commit 9bc83e8Copy full SHA for 9bc83e8
1 file changed
scenes/Player.gd
@@ -1,10 +1,10 @@
1
extends CharacterBody2D
2
3
-
4
@export var speed: int = 400
5
@export var GRAVITY: int = 1200
6
@export var jump_speed: int = -400
7
+
8
func get_input():
9
velocity.x = 0
10
if is_on_floor() and Input.is_action_just_pressed("jump"):
@@ -14,19 +14,21 @@ func get_input():
14
if Input.is_action_pressed("left"):
15
velocity.x -= speed
16
17
18
func _physics_process(delta):
19
velocity.y += delta * GRAVITY
20
get_input()
21
move_and_slide()
22
23
24
func _process(_delta):
25
if not is_on_floor():
26
$Animator.play("Jump")
27
elif velocity.x != 0:
28
$Animator.play("Walk")
29
else:
30
$Animator.play("Idle")
31
32
if velocity.x != 0:
33
if velocity.x > 0:
34
$Sprite2D.flip_h = false
0 commit comments