diff options
author | Indrajith K L | 2022-04-18 01:21:58 +0530 |
---|---|---|
committer | Indrajith K L | 2022-04-18 01:21:58 +0530 |
commit | 77b9080c3b375b44b0cd830fe31bf60480c85619 (patch) | |
tree | 986583402ff6c3517fbe04a7f172c346713bb1e8 /collectables/Apple.gd | |
parent | 31089507aae1d35d0deeb2c412cfa311e7a57563 (diff) | |
download | gamedevjs-jam-77b9080c3b375b44b0cd830fe31bf60480c85619.tar.gz gamedevjs-jam-77b9080c3b375b44b0cd830fe31bf60480c85619.tar.bz2 gamedevjs-jam-77b9080c3b375b44b0cd830fe31bf60480c85619.zip |
Player Animation converted to Animation Tree
Level 1 Design
Door Mechanism
Core Gameplay Mechanism - In-Progress
Diffstat (limited to 'collectables/Apple.gd')
-rw-r--r-- | collectables/Apple.gd | 7 |
1 files changed, 5 insertions, 2 deletions
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(): |