Hi everyone,
Basically I have a main menu with two buttons (start game and exit game). I've created a sample player, a new sample library, imported/converted my wav files and then loaded the smp files into the sample library.
All I want to do is to be able to play the sound I've loaded in when I click my buttons. This does work (sort of) at the moment, except the sound isn't played fully, it starts and then it is cut off. I believe this is because it quickly plays the audio and then proceeds to move on to the next line of code, effectively cutting it off during playback.
Here is my code for my start game button:
extends Node
func _ready():
set_process(true)
func _on_Start_Game_pressed():
get_node("../SamplePlayer").play("Sound1")
get_tree().change_scene("res://levels/level_one_game.scn")
And here is the code to my exit game button:
extends Node
func _on_Exit_Game_pressed():
get_node("../SamplePlayer").play("Sound1")
get_tree().quit()
Does anyone know a way around this? I asked when I was on the IRC and some body mentioned 'ResourceInteractiveLoader' and somebody else mentioned 'threads'. I've never heard of either of these, and I'm not sure if they are the way to do it or not. Any help with this would be greatly appreciated, no doubt it's something very simple.
Thanks!