- Edited
hi guys... i want to pause the game before scenes of 2 players load completely. but thats not a problem, problem begins when i want to unpause the game. i created a pause menu for this, changed its mode to "process" (mode of countdown node is process too) and wrote this code in pause menu:
extends Panel
onready var waiting = get_node("Waiting")
# labels and tween for showing countdown (3,2,1)
onready var count_down = get_tree().get_root().get_node("PvP/CountDown")
onready var three = get_tree().get_root().get_node("PvP/CountDown/3")
onready var two = get_tree().get_root().get_node("PvP/CountDown/2")
onready var one = get_tree().get_root().get_node("PvP/CountDown/1")
onready var t3 = get_tree().get_root().get_node("PvP/CountDown/T3")
onready var t2 = get_tree().get_root().get_node("PvP/CountDown/T2")
onready var t1 = get_tree().get_root().get_node("PvP/CountDown/T1")
var p1 #(set this one to "false" in lobby)
var p2 #(set this one to "false" in lobby)
func _ready():
t3.interpolate_property(three, "transform/scale", three.rect_scale, Vector2(2, 2), 1,
Tween.TRANS_QUAD, Tween.EASE_OUT)
t2.interpolate_property(two, "transform/scale", two.rect_scale, Vector2(2, 2), 1,
Tween.TRANS_QUAD, Tween.EASE_OUT)
t1.interpolate_property(one, "transform/scale", one.rect_scale, Vector2(2, 2), 1,
Tween.TRANS_QUAD, Tween.EASE_OUT)
func _on_Paused_pressed():
waiting.show() # show some label
post_pressed(p1,p2)
# i think problem is in this function, because variables are not being sent
func post_pressed(p1, p2):
if get_tree().is_network_server():
p1 = true
rset("p1", true)
else:
p2 = true
rset("p2", true)
if p1 == true && p2 == true:
self.hide() # hiding the pause menu
count_down.show() # just made a visual countdown like ("3, 2, 1")
three.show() # show label
t3.start() # start tween for showing the countdown
func _on_T3_tween_completed(object, key):
three.queue_free()
three.hide()
two.show()
t2.start()
func _on_T2_tween_completed(object, key):
two.queue_free()
two.hide()
one.show()
t1.start()
func _on_T1_tween_completed(object, key):
one.queue_free()
one.hide()
count_down.hide()
get_tree().set_pause(false) # this code does not work (actually countdown does not begin)
it seems variables (p1,p2) are not being sent, so game doesnt resume, what should i do now?
Any help would be greatly appreciated :)