From 77b9080c3b375b44b0cd830fe31bf60480c85619 Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 18 Apr 2022 01:21:58 +0530 Subject: Player Animation converted to Animation Tree Level 1 Design Door Mechanism Core Gameplay Mechanism - In-Progress --- collectables/Apple.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'collectables/Apple.gd') diff --git a/collectables/Apple.gd b/collectables/Apple.gd index abf0db3..c69a100 100644 --- a/collectables/Apple.gd +++ b/collectables/Apple.gd @@ -1,13 +1,16 @@ extends Node2D export var health=10 +var collected = false func _ready(): $AnimationPlayer.play("idle") func _on_Area2D_body_entered(body): - if (body.name=="Player"): - body.health += health + 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(): -- cgit v1.2.3