extends Area2D

export var Bonus = 1

func _ready():
	connect("body_entered", self, "_on_body_entered");
	$Aplayer.connect("finished", self, "_on_aplayer_finished");

func _on_aplayer_finished():
	queue_free()

func _on_body_entered(body):
	if not body.has_method("kick_after"):
		return
	$Aplayer.play()
	$Colli.disabled = true
	$Colli/gem.hide()
	$"/root/global".score += Bonus