add jumping sound

This commit is contained in:
2025-10-21 20:28:54 +01:00
parent cb0721103a
commit a1b28ee5d3
2 changed files with 50 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ extends CharacterBody2D
@export var jump_velocity = -400.0
@onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D
@onready var animation_player: AnimationPlayer = $AnimationPlayer
func _physics_process(delta: float) -> void:
# Add the gravity.
@@ -13,6 +14,7 @@ func _physics_process(delta: float) -> void:
# Handle jump.
if Input.is_action_just_pressed("jump") and is_on_floor():
animation_player.play("jump")
velocity.y = jump_velocity
# Get the input direction and handle the movement/deceleration.