-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.gd
72 lines (46 loc) · 1.71 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
extends Node3D
@onready var label_text = $Control/Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
get_tree().set_auto_accept_quit(false)
## Luego cargar la escena principal
#var main_scene = load("res://ruta/a/tu/escena_principal.tscn")
#get_tree().change_scene_to(main_scene)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
label_text.text = str(Engine.get_frames_per_second())
pass
func _input(event: InputEvent) -> void:
if Input.is_key_pressed(KEY_K):
prints("hola emanuel")
var player = preload("res://player/Player.tscn").instantiate()
add_child(player)
prints("instancio escena")
await get_tree().create_timer(3).timeout
func _on_menu_pressed() -> void:
prints("hola emanuel")
var menu = preload("res://escenas/menu_config/menu_config.tscn").instantiate()
add_child(menu)
prints("instancio escena")
await get_tree().create_timer(3).timeout
pass # Replace with function body.
func _notification(what):
if what == NOTIFICATION_WM_CLOSE_REQUEST:
prints("hola emanuel")
var menu = preload("res://quit.tscn").instantiate()
add_child(menu)
prints("instancio escena")
await get_tree().create_timer(3).timeout
prints("quit")
#get_tree().quit() # default behavior NOTIFICATION_WM_GO_BACK_REQUEST
if what == NOTIFICATION_WM_GO_BACK_REQUEST:
prints("hola emanuel")
var menu = preload("res://quit.tscn").instantiate()
add_child(menu)
prints("instancio escena")
await get_tree().create_timer(3).timeout
prints("quit")
# Cambiar configuración de renderizado
func _on_timer_timeout() -> void:
pass # Replace with function body.