From d517be7b43982dae6475ab36f118e52e12e06de4 Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sun, 20 Nov 2022 17:06:31 -0300 Subject: [PATCH] give bolts a value and a callable function --- scenes/collectables/Bolt.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scenes/collectables/Bolt.cs b/scenes/collectables/Bolt.cs index 2c2ce18..c609d5d 100644 --- a/scenes/collectables/Bolt.cs +++ b/scenes/collectables/Bolt.cs @@ -3,6 +3,8 @@ using System; public class Bolt : Area2D { + [Export] + private int _value = 1; private Event _eventBus; public override void _Ready() @@ -18,8 +20,13 @@ public class Bolt : Area2D SetCollisionLayerBit((int) Game.PhysicsLayer.Collectable, false); if (String.Equals(body.Name, "Player")) { - _eventBus.EmitSignal("BoltCollected", 1); + Collected(); } + } + + public void Collected() + { + _eventBus.EmitSignal("BoltCollected", _value); QueueFree(); } }