extends Node2D @export var audio_collection: AudioStreamCollection signal interacted signal cancel var activated = false var base_scale: Vector2 var random_audio_player = RandomAudioStreamPlayer.new() func _ready() -> void: var point_light = get_node("./PointLight2D") if point_light: point_light.energy = 0.0 modulate.a = 0 base_scale = scale random_audio_player.audio_collections.append(audio_collection) random_audio_player.bus = GlobalConfig.AUDIO_BUS_SFX add_child(random_audio_player) func activate(_body: Node2D) -> void: # point_light.energy = 1.0 activated = true var tween = create_tween() tween.tween_property(self, "modulate:a", 1.0, 0.2) var p_tween = tween.parallel() p_tween.tween_property(self, "scale", base_scale * Vector2(1.2, 1.2), 0.3) p_tween.tween_property(self, "scale", base_scale, 0.1) func disactivate(_body: Node2D) -> void: # point_light.energy = 0.0 activated = false create_tween().tween_property(self, "modulate:a", 0.0, 0.2) func _input(event: InputEvent) -> void: if activated: if event.is_action_pressed("interact"): interacted.emit() if audio_collection: random_audio_player.play_random() elif event.is_action_pressed("cancel"): cancel.emit()