2020-10-04 18:26:45 +00:00
|
|
|
extends Area2D
|
|
|
|
class_name Loop
|
|
|
|
|
|
|
|
|
|
|
|
signal picked_up
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2020-10-06 10:02:10 +00:00
|
|
|
$Sprite.self_modulate = Color.from_hsv(GLOBAL.rng.randf_range(0.0, 1.0), 0.4, 1)
|
2020-10-04 18:26:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Loop_body_entered(body):
|
|
|
|
emit_signal("picked_up")
|
2020-10-05 14:38:54 +00:00
|
|
|
body.loops_collected += 1
|
2020-10-05 14:44:38 +00:00
|
|
|
body.get_node("Donut").self_modulate = $Sprite.self_modulate
|
2020-10-05 16:34:41 +00:00
|
|
|
body.emit_signal("loop_collected", body.loops_collected)
|
2020-10-04 19:32:18 +00:00
|
|
|
$AnimationPlayer.play("pop fade out")
|
|
|
|
|
|
|
|
|
|
|
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
2020-10-04 18:26:45 +00:00
|
|
|
queue_free()
|
2020-10-04 19:32:18 +00:00
|
|
|
|
|
|
|
|