Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | popon2 |
Hi, I making a racing game project and i have a problem with get_tree().paused...
.
I am using it first time for the “lights”, when the race is started. After the lights out, get_tree().paused = false
then i can pressed escape button for “pause menu” in the race. But it is not pause game (its just instance pause menu - witch have in script if is _ready(): get_tree().paused = true
, but it is not hapend).
But when i delete lights from the files the “paused menu” works, but there is nothing betwen them, just same parent call “main”.
Scene tree after instancing: main/racing gui/lights
and main/paused menu/
…
Both of them have Paused mod change to proces, other nodes in the tree have Inherit. Does somebody know where is a problem? Can it be a bug of godot?
Are you sure your pause menu is pausing the scene tree AFTER the lights unpause it?
Zylann | 2018-09-06 12:43
yes, I am sure, because player can not move until the lights are out…
here is the part of lights script (light is var, if Lights_timer_timeout, light +=1 and game_run is var in main scene after that start working escape button for pause menu):
func _process(delta):
if light >= 6:
$Lights_Timer.stop()
get_tree().paused = false
get_parent().get_parent().game_run = true
if transparency != 0:
transparency -= 0.02
else:
queue_free()
$CanvasLayer/Light_Sprite.modulate = Color(1,1,1,transparency)
popon2 | 2018-09-06 12:58