1
Fork 0
mirror of https://github.com/Steffo99/looping-for-loops.git synced 2024-11-28 19:14:20 +00:00
looping-for-loops/Objects/ScrollingObjects/Loop.gd

24 lines
370 B
GDScript3
Raw Normal View History

2020-10-04 18:26:45 +00:00
extends Area2D
class_name Loop
var rng = RandomNumberGenerator.new()
signal picked_up
func _ready():
rng.randomize()
$Sprite.modulate = Color.from_hsv(rng.randf_range(0.0, 1.0), 0.4, 1)
func _on_Loop_body_entered(body):
emit_signal("picked_up")
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