#Button won't open new scene
7 messages · Page 1 of 1 (latest)
Here is the code for the transition
extends CanvasLayer
signal on_transition_finished
@onready var color_rect = $ColorRect
@onready var animation_player = $AnimationPlayer
func _ready():
color_rect.visible = false
animation_player.animation_finished.connect(_on_animation_finished)
func _on_animation_finished(anim_name):
if anim_name == "fade_to_black":
on_transition_finished.emit()
animation_player.play("fade_to_normal")
elif anim_name == "fade_to_normal":
color_rect.visible = true
func transition():
color_rect.visible = true
animation_player.play("fade_to_black")
as well the button
func _on_texture_button_pressed():
TransitionScreen.transition()
await TransitionScreen.on_transition_finished
get_tree().change_scene_to_file("res://scene/loading.tscn")
@stark hemlock If I understand your structure, color_rect.visible should = false instead of true when "fade_to_normal" finishes should it not?
dude you saved me so much time TYSM!