-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.gd
31 lines (24 loc) · 887 Bytes
/
main.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
extends AbstractScreen
var _screens = {
"menu": preload("res://screens/menu/menu_screen.tscn"),
"builder": preload("res://screens/builder/builder_screen.tscn"),
"room_combat": preload("res://screens/room_combat/room_combat.tscn")
}
onready var _screen_layer = $ScreenLayer
func _ready():
randomize()
CardEngine.clean()
CardEngine.setup()
change_screen("menu")
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton and not event.is_pressed():
if CardEngine.general().is_dragging():
CardEngine.general().stop_drag()
func change_screen(screen_name: String) -> void:
if !_screens.has(screen_name): return
for child in _screen_layer.get_children():
_screen_layer.remove_child(child)
child.queue_free()
var screen = _screens[screen_name].instance()
screen.connect("next_screen", self, "change_screen")
_screen_layer.add_child(screen)