aboutsummaryrefslogtreecommitdiff
path: root/collectables/Apple.gd
blob: c69a1004604f3e739d5361351dbf0b74ea297870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extends Node2D

export var health=10
var collected = false
func _ready():
	$AnimationPlayer.play("idle")

func _on_Area2D_body_entered(body):
	if (body.name=="Player" and !collected):
		collected = true
		SignalBus.emit_signal("on_apples_collected",1)
		self.hide()
		$Sprite/Area2D.set_collision_mask_bit(1,false)
		$pickup.play()

func _on_pickup_finished():
	queue_free()