41 lines
822 B
GDScript
41 lines
822 B
GDScript
extends CanvasLayer
|
|
|
|
var pause = false : set = set_pause
|
|
|
|
const PLANET_RUN_SCENE = preload("res://stages/planet_run/planet_run.tscn")
|
|
|
|
func set_pause(p):
|
|
if p != pause:
|
|
if p:
|
|
%AnimationPlayer.play("pause")
|
|
else:
|
|
%AnimationPlayer.play_backwards("pause")
|
|
pause = p
|
|
get_tree().paused = pause
|
|
%Settings.close_settings()
|
|
%Controls.close_controls()
|
|
|
|
func _input(_event):
|
|
if Input.is_action_just_pressed("pause"):
|
|
pause = not pause
|
|
|
|
func _on_resume_pressed():
|
|
pause = false
|
|
|
|
func _on_restart_pressed():
|
|
GameInfo.game_data.reset_all()
|
|
pause = false
|
|
get_tree().change_scene_to_packed(PLANET_RUN_SCENE)
|
|
|
|
func _on_quit_pressed():
|
|
get_tree().quit()
|
|
|
|
func _on_game_gui_pause_asked():
|
|
pause = true
|
|
|
|
func _on_settings_pressed():
|
|
%Settings.open_settings()
|
|
|
|
func _on_controls_pressed():
|
|
%Controls.open_controls()
|