martes, 23 de julio de 2024

Script en gdscript para godot 4.2 , para al presionar escape sales del juego y para que transcurridos 24 segundos se cambie la escena del juego;

 extends WorldEnvironment




var tiempo_transcurrido = 0.0  # Variable para almacenar el tiempo transcurrido


func _process(delta):


if Input.is_action_pressed("ui_cancel"):

get_tree().quit()






tiempo_transcurrido += delta


# Si han pasado 20 segundos, elimina el nodo

if tiempo_transcurrido >= 24.0:

#queue_free()

var siguiente_escena = preload("res://LAS SEIS ESCENAS CORTAS DE ENTRADA/LA 6 PLANO GENERAL EN LA HABITACION DEL PROTA/SOLO ROSTRO-2-.tscn")  # Precargar la escena


get_tree().change_scene_to_packed(siguiente_escena)  # Cambiar a la escena precargada (Godot 4.2)


#queue_free()  # Liberar este nodo después del cambio de escena

pass # Replace with function body.