I'm testing my first ever custom signal.
In this test, I have it working so when I press 1, 2 or 3 on the keyboard, the speed of my bat changes. This works so that's great.
Now I want it so when the speed changes, a signal is emitted. (I believe I have this part correct). When that signal is emitted, a function is called to change the text of a label.
Except it doesn't. Can anyone offer some advice as to what I've done wrong? This is my first custom signal. Thank you.
onready var speedLabelL = get_node("/root/gameLevel/HUD/SpeedL")
print("We have a label")
speedLabelL.connect("batSpeedChanged", self, "updateScoresEtc")
func changeBatSpeed(bat, speed):
if bat == 0: #left bat
game.batSpeedL = speed
elif bat == 1: #right bat
game.batSpeedR = speed
print("Bat speed = ", str(speed), " for bat # ", str(bat))
emit_signal("batSpeedChanged", bat, speed)
func updateScoresEtc(bat, speed):
print("signal should happen with bat", str(bat), " and speed of ", str(speed))
print("This is where we'll change the label text")
Just a note, all the print statements work except for the last one in the