Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Rayu |
func spawn_Player1(num):
for i1 in range(num):
var p1 = player1.instance()
p1.connect("Player1_pressed", self, "_on_Player1_pressed")
Player_container1.add_child(p1)
func _on_Player1_pressed():
if Globals.timeLeft > 0:
Globals.timeLeft += 5
if Globals.timeLeft > Globals.maxTime:
Globals.timeLeft = Globals.maxTime
Globals.Score += 1
yield(get_tree().create_timer(2.0), "timeout")
get_tree().change_scene("res://Game.tscn")
func spawn_Enemy1():
var rand1 = floor(rand_range(0, Enemy1.size()))
var piece1 = Enemy1[rand1].instance()
add_child(piece1)
On Player Pressed, the Scene waits 2 seconds before it’s changing Scene. I would like to add a function where the Player freezes in those 2 seconds. And the score doesn’t go up, you should only get +1 Score per Scene.