GodotCourse/week6/updated_project/scripts/coin.gd

10 lines
215 B
GDScript3
Raw Permalink Normal View History

2024-08-19 19:27:40 +00:00
class_name Coin extends Area2D
2024-08-19 15:21:33 +00:00
2024-08-19 19:27:40 +00:00
#Note: signal created - better to 'signal up' and 'call down'
2024-08-19 15:21:33 +00:00
signal coinCollected
func _on_body_entered(body):
if body.is_in_group("player"):
coinCollected.emit()
queue_free()