I want that my player made an sound when he jump there is my code :
extends KinematicBody2D
const UP = Vector2(0, -1)
const GRAVITY = 20
var SPEED = 200
const JUMPHEIGHT = -400
var motion = Vector2()
func _physicsprocess(delta):
motion.y += GRAVITY
var friction = false
if Input.isactionpressed("uiright"):
motion.x = SPEED
$Sprite.play("Walk")
$Sprite.fliph = false
elif Input.isactionpressed("uileft"):
motion.x = -SPEED
$Sprite.play("Walk")
$Sprite.fliph = true
else:
motion.x = 0
$Sprite.play("Idle")
if isonfloor():
if Input.isactionjustpressed("uiup"):
motion.y = JUMPHEIGHT
motion = moveandslide(motion, UP)
pass
if Input.isactionjustpressed("dash"):
dash()
if SPEED == 400 and friction == false:
$Sprite.play("Dash")
func dash():
SPEED = 400
$Timer.start()
func onTimer_timeout():
SPEED = 200