37 lines
833 B
GDScript
37 lines
833 B
GDScript
extends Node
|
|
|
|
var reset = false
|
|
var switch = false
|
|
var scene = 0
|
|
#0 is title, 1 is game
|
|
var title = Sprite2D
|
|
var game = Node2D
|
|
var win = Sprite2D
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
title = preload("res://Scenes/Title.tscn")
|
|
game = preload("res://Scenes/Main.tscn")
|
|
win = preload("res://Scenes/Win.tscn")
|
|
var instance = title.instantiate()
|
|
add_child(instance)
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
if switch == true:
|
|
get_child(0).queue_free()
|
|
match scene:
|
|
0:
|
|
var instance = title.instantiate()
|
|
add_child(instance)
|
|
1:
|
|
var instance = game.instantiate()
|
|
add_child(instance)
|
|
print("reload!")
|
|
reset = true
|
|
2:
|
|
var instance = win.instantiate()
|
|
add_child(instance)
|
|
switch = false
|