add jumping sound
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user