2023-10-02 00:53:12 +00:00
|
|
|
extends StaticBody2D
|
2023-10-02 01:14:45 +00:00
|
|
|
class_name Converter
|
2023-10-02 00:53:12 +00:00
|
|
|
|
|
|
|
var coda : int = 0
|
|
|
|
|
|
|
|
@export var sprite_front: AnimatedSprite2D
|
|
|
|
@export var conversion_timer: Timer
|
|
|
|
@export var sound_working: AudioStreamPlayer
|
|
|
|
@export var sound_complete: AudioStreamPlayer
|
|
|
|
@export var spawner: Spawner
|
|
|
|
|
|
|
|
func _on_collector_collected(body):
|
|
|
|
body.queue_free()
|
|
|
|
|
|
|
|
func _on_collector_goal():
|
|
|
|
coda+=1
|
|
|
|
|
|
|
|
func _process(_delta):
|
|
|
|
if coda>=1 and conversion_timer.is_stopped():
|
|
|
|
sprite_front.play()
|
|
|
|
conversion_timer.start()
|
|
|
|
sound_working.play()
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
coda-=1
|
|
|
|
sprite_front.stop()
|
|
|
|
sound_working.stop()
|
|
|
|
sound_complete.play()
|
|
|
|
spawner.spawn()
|