Just thought it would be fun to have random jump sounds coming from the poor bunny. Fired up my Google-Fu and came up with this.
I just made a bunch of sounds ending with _0, _1 and so on. Then one line loads one of the sounds at random into the AudioStreamPlayer and then play it.
func jump(): if Input.is_action_pressed("jump") and is_on_floor(): motion.y -= JUMP_SPEED # $JumpSFX.play() # Let's play a random jump sound :D $JumpBoing.stream = load("res://SFX/Boing/boing_" + str(randi() % 13) + ".wav") $JumpBoing.play()
Might be better solutions, but this works like a charm for me. Hope someone else also can find some use for it.