extends Area2D @export_file() var sceneFilePath @export var targetPlayerPositionNodePath: String @export_enum("up", "down", "left", "right") var playerFacing: String = "down" var scene func _ready(): self.scene = load(self.sceneFilePath).instantiate() func _on_body_entered(body: Node2D): if body.is_in_group("player"): var player = body.duplicate(DUPLICATE_USE_INSTANTIATION) body.process_mode = Node.PROCESS_MODE_DISABLED # var img_current = get_viewport().get_texture().get_image() # var viewport = get_viewport_rect() # img_current.resize(viewport.size.x, viewport.size.y) # $Sprite2D.texture = ImageTexture.create_from_image(img_current) # # var camera: Camera2D = body.get_node("Camera2D") # $Sprite2D.global_position = camera.get_screen_center_position() # # var tween = create_tween() # tween.tween_property($Sprite2D, "modulate", Color(0, 0, 0, 1), 0.75) var tween = Utilities.fade_screen(Color(0, 0, 0, 0), Color(0, 0, 0, 1), 0.75) Utilities.fade_bg_music(0.75) tween.connect("finished", func(): Utilities.change_scene_with_player_to_position( self.scene, player, NodePath(targetPlayerPositionNodePath), playerFacing ) )