Hello, i know that is the old post and i have the same problem. I was searching for this type of tutorial of this language, but can't find any proper one. I develop mostly in C# and VB in .NET environment so this GD language is quite a strange one to me, altough i have read the documentation i can't fully understand it.
But how would the code look like?
I figured it out all the way to moving the player, and almost all code that is about playing the sound only once i commented out as non-working.
if is_on_floor():
playerIsLanded = true
#get_node("Get_Back_to_FloorSND").play()
#getbacktofloor_sound.play()
# if playerIsLanded == true:
# getbacktofloor_sound.play()
# else:
# getbacktofloor_sound.stop()
if Input.is_action_just_pressed("Jump"):
motion.y = jump_height
if friction == true:
motion.x = lerp(motion.x, 0, 0.2)
else:
if motion.y < 0:
#$Sprite.play("Jump")
null
else:
#$Sprite.play("test")
null
if friction == true:
motion.x = lerp(motion.x, 0, 0.05)
motion = move_and_slide(motion, up)
pass
I am using both Waveform and Vorbis sound containers, and in import settings all of my sounds in this test project have LOOP turned off in Import tab, so this is not the problem.
Is there a method that can be called like this:
getbacktofloor_sound.playonce()
instead of this:
getbacktofloor_sound.play()
Thanks for feedback