aboutsummaryrefslogtreecommitdiff
path: root/collectables
diff options
context:
space:
mode:
Diffstat (limited to 'collectables')
-rw-r--r--collectables/Apple.gd11
-rw-r--r--collectables/Apple.pngbin0 -> 1065 bytes
-rw-r--r--collectables/Apple.png.import35
-rw-r--r--collectables/Apple.tscn58
4 files changed, 104 insertions, 0 deletions
diff --git a/collectables/Apple.gd b/collectables/Apple.gd
new file mode 100644
index 0000000..909eaf2
--- /dev/null
+++ b/collectables/Apple.gd
@@ -0,0 +1,11 @@
+extends Node2D
+
+export var health=10
+func _ready():
+ $AnimationPlayer.play("idle")
+
+
+func _on_Area2D_body_entered(body):
+ if body.entity_type=="PLAYER":
+ body.health += health
+ queue_free()
diff --git a/collectables/Apple.png b/collectables/Apple.png
new file mode 100644
index 0000000..7736b46
--- /dev/null
+++ b/collectables/Apple.png
Binary files differ
diff --git a/collectables/Apple.png.import b/collectables/Apple.png.import
new file mode 100644
index 0000000..024bb14
--- /dev/null
+++ b/collectables/Apple.png.import
@@ -0,0 +1,35 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/Apple.png-b72abf7889fb8efcb31c67fe59a30b5a.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://collectables/Apple.png"
+dest_files=[ "res://.import/Apple.png-b72abf7889fb8efcb31c67fe59a30b5a.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=false
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+process/normal_map_invert_y=false
+stream=false
+size_limit=0
+detect_3d=false
+svg/scale=1.0
diff --git a/collectables/Apple.tscn b/collectables/Apple.tscn
new file mode 100644
index 0000000..681e6ce
--- /dev/null
+++ b/collectables/Apple.tscn
@@ -0,0 +1,58 @@
+[gd_scene load_steps=6 format=2]
+
+[ext_resource path="res://collectables/Apple.png" type="Texture" id=1]
+[ext_resource path="res://collectables/Apple.gd" type="Script" id=2]
+
+[sub_resource type="RectangleShape2D" id=1]
+extents = Vector2( 6, 7 )
+
+[sub_resource type="Animation" id=2]
+length = 0.001
+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 = {
+"times": PoolRealArray( 0 ),
+"transitions": PoolRealArray( 1 ),
+"update": 0,
+"values": [ 0 ]
+}
+
+[sub_resource type="Animation" id=3]
+resource_name = "idle"
+loop = true
+step = 0.0625
+tracks/0/type = "bezier"
+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 )
+}
+
+[node name="Apple" type="Node2D"]
+script = ExtResource( 2 )
+
+[node name="Sprite" type="Sprite" parent="."]
+texture = ExtResource( 1 )
+hframes = 17
+
+[node name="Area2D" type="Area2D" parent="Sprite"]
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite/Area2D"]
+position = Vector2( 0, -2 )
+shape = SubResource( 1 )
+
+[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
+playback_default_blend_time = 387.02
+playback_speed = 64.0
+anims/RESET = SubResource( 2 )
+anims/idle = SubResource( 3 )
+
+[connection signal="body_entered" from="Sprite/Area2D" to="." method="_on_Area2D_body_entered"]