I have this script that at this point, Im just trying to make work. I have been looking over tutorials and documents but its hard to take it all in at once. This is my script ```extends Area2D
Reference to your AudioStreamPlayer2D node
@onready var portal_sound: AudioStreamPlayer2D = $PortalSound
Reference to your Sprite node for the fade effect
@onready var fade_sprite: Sprite2D = $fade # Adjust the name to match your actual node name
func _ready():
# Connect the "area_entered" signal to the "_on_area_entered" function
area_entered.connect(area_entered, "_on_area_entered")
func _on_area_entered(area: Area2D) -> void:
# Check if the area is your character
if area.name == "Player":
# Play the portal sound
portal_sound.play()
# Configure the fade effect
fade_sprite.custom_minimum_size = get_viewport().size # Make it cover the entire screen
fade_sprite.custom_minimum_size.x *= 2 # Ensure it covers both horizontal sides
fade_sprite.custom_minimum_size.y *= 2 # Ensure it covers both vertical sides
fade_sprite.custom_minimum_size = fade_sprite.custom_minimum_size.ceil() # Round up to the nearest integer
fade_sprite.modulate = Color(0, 0, 0, 0) # Start with fully transparent
# Create a Tween for the fade effect
var tween = get_tree().create_tween()
add_child(tween)
# Tween the transparency to 1 (fully opaque)
tween.interpolate_property(fade_sprite, "modulate:a", 0, 1, 1.0, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
# Start the tween
tween.start()
# Wait for the sound to finish
await portal_sound.finished
# Transition to the main menu scene
get_tree().change_scene("res://main_menu.tscn")