aboutsummaryrefslogtreecommitdiff
path: root/collectables
diff options
context:
space:
mode:
authorIndrajith K L2022-04-18 01:21:58 +0530
committerIndrajith K L2022-04-18 01:21:58 +0530
commit77b9080c3b375b44b0cd830fe31bf60480c85619 (patch)
tree986583402ff6c3517fbe04a7f172c346713bb1e8 /collectables
parent31089507aae1d35d0deeb2c412cfa311e7a57563 (diff)
downloadgamedevjs-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')
-rw-r--r--collectables/Apple.gd7
-rw-r--r--collectables/Apple.tscn15
2 files changed, 14 insertions, 8 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():
diff --git a/collectables/Apple.tscn b/collectables/Apple.tscn
index fe4a8e9..e092a9c 100644
--- a/collectables/Apple.tscn
+++ b/collectables/Apple.tscn
@@ -24,17 +24,20 @@ tracks/0/keys = {
[sub_resource type="Animation" id=3]
resource_name = "idle"
+length = 2.0
loop = true
-step = 0.0625
-tracks/0/type = "bezier"
+step = 0.04
+tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
-"points": PoolRealArray( 0, -0.25, 0, 0.25, 0, 1, -0.25, 0, 0.25, 0, 2, -0.25, 0, 0.25, 0, 3, -0.25, 0, 0.25, 0, 4, -0.25, 0, 0.25, 0, 5, -0.25, 0, 0.25, 0, 6, -0.25, 0, 0.25, 0, 7, -0.25, 0, 0.25, 0, 8, -0.25, 0, 0.25, 0, 9, -0.25, 0, 0.25, 0, 10, -0.25, 0, 0.25, 0, 11, -0.25, 0, 0.25, 0, 12, -0.25, 0, 0.25, 0, 13, -0.25, 0, 0.25, 0, 14, -0.25, 0, 0.25, 0, 15, -0.25, 0, 0.25, 0, 16, -0.25, 0, 0.25, 0 ),
-"times": PoolRealArray( 0, 0.0625, 0.125, 0.1875, 0.25, 0.3125, 0.375, 0.4375, 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1 )
+"times": PoolRealArray( 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9 ),
+"transitions": PoolRealArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ),
+"update": 1,
+"values": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16 ]
}
[node name="Apple" type="Node2D"]
@@ -52,11 +55,11 @@ shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
playback_default_blend_time = 387.02
-playback_speed = 64.0
+playback_speed = 6.56
anims/RESET = SubResource( 2 )
anims/idle = SubResource( 3 )
-[node name="pickup" type="AudioStreamPlayer2D" parent="."]
+[node name="pickup" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
[connection signal="body_entered" from="Sprite/Area2D" to="." method="_on_Area2D_body_entered"]