mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 15:38:14 +00:00
added the game
This commit is contained in:
21
Scripts/Classes/Components/SecondQuestReplaceComponent.gd
Normal file
21
Scripts/Classes/Components/SecondQuestReplaceComponent.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
class_name SecondQuestReplacer
|
||||
extends Node
|
||||
|
||||
@export_file("*.tscn") var new_scene := ""
|
||||
@export var properties: Array[String] = []
|
||||
|
||||
func _ready() -> void:
|
||||
if Global.second_quest and new_scene != "" and new_scene != owner.scene_file_path:
|
||||
if owner.owner != null:
|
||||
await owner.owner.ready
|
||||
var node = load(new_scene).instantiate()
|
||||
node.global_position = owner.global_position
|
||||
node.global_rotation = owner.global_rotation
|
||||
for i in properties:
|
||||
node.set(i, owner.get(i))
|
||||
owner.add_sibling(node)
|
||||
if owner is RopeElevatorPlatform:
|
||||
owner.linked_platform.linked_platform = node
|
||||
owner.queue_free()
|
||||
else:
|
||||
queue_free()
|
Reference in New Issue
Block a user