Fixed Signals, effects, and collisions.

This commit is contained in:
Alan Youngblood
2025-01-18 12:02:23 -05:00
parent 41db52db5c
commit 3db440b7a9
10 changed files with 231 additions and 149 deletions

View File

@ -1,7 +1,6 @@
extends AnimatedSprite2D
func _ready():
connect("animation_finished", Callable(self, "_on_animation_finished"))
frame = 0
play("Animate")

View File

@ -1,63 +1,95 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=15 format=3 uid="uid://bv2jjgk6veq4l"]
[ext_resource path="res://Effects/Effect.gd" type="Script" id=1]
[ext_resource path="res://Effects/EnemyDeathEffect.png" type="Texture2D" id=2]
[ext_resource path="res://Music and Sounds/EnemyDie.wav" type="AudioStream" id=3]
[ext_resource type="Script" path="res://Effects/Effect.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://bmfqf7no8uc14" path="res://Effects/EnemyDeathEffect.png" id="2"]
[ext_resource type="AudioStream" uid="uid://ceo7s8pddaqww" path="res://Music and Sounds/EnemyDie.wav" id="3"]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="1"]
atlas = ExtResource("2")
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 2 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="2"]
atlas = ExtResource("2")
region = Rect2(32, 0, 32, 32)
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 2 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="3"]
atlas = ExtResource("2")
region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 2 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="4"]
atlas = ExtResource("2")
region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 2 )
region = Rect2( 128, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="5"]
atlas = ExtResource("2")
region = Rect2(128, 0, 32, 32)
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 2 )
region = Rect2( 160, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="6"]
atlas = ExtResource("2")
region = Rect2(160, 0, 32, 32)
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 2 )
region = Rect2( 192, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="7"]
atlas = ExtResource("2")
region = Rect2(192, 0, 32, 32)
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 2 )
region = Rect2( 224, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="8"]
atlas = ExtResource("2")
region = Rect2(224, 0, 32, 32)
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 2 )
region = Rect2( 256, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="9"]
atlas = ExtResource("2")
region = Rect2(256, 0, 32, 32)
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 2 )
region = Rect2( 288, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="10"]
atlas = ExtResource("2")
region = Rect2(288, 0, 32, 32)
[sub_resource type="SpriteFrames" id=11]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ],
"loop": true,
"name": "Animate",
[sub_resource type="SpriteFrames" id="11"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("1")
}, {
"duration": 1.0,
"texture": SubResource("2")
}, {
"duration": 1.0,
"texture": SubResource("3")
}, {
"duration": 1.0,
"texture": SubResource("4")
}, {
"duration": 1.0,
"texture": SubResource("5")
}, {
"duration": 1.0,
"texture": SubResource("6")
}, {
"duration": 1.0,
"texture": SubResource("7")
}, {
"duration": 1.0,
"texture": SubResource("8")
}, {
"duration": 1.0,
"texture": SubResource("9")
}, {
"duration": 1.0,
"texture": SubResource("10")
}],
"loop": false,
"name": &"Animate",
"speed": 15.0
} ]
}]
[node name="EnemyDeathEffect" type="AnimatedSprite2D"]
frames = SubResource( 11 )
animation = "Animate"
offset = Vector2( 0, -8 )
script = ExtResource( 1 )
sprite_frames = SubResource("11")
animation = &"Animate"
offset = Vector2(0, -8)
script = ExtResource("1")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
stream = ExtResource("3")
autoplay = true
[connection signal="animation_finished" from="." to="." method="_on_animation_finished"]

View File

@ -1,39 +1,58 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=9 format=3 uid="uid://mhvl6s2ugm6y"]
[ext_resource path="res://Effects/GrassEffect.png" type="Texture2D" id=1]
[ext_resource path="res://Effects/Effect.gd" type="Script" id=2]
[ext_resource type="Texture2D" uid="uid://b7rtfcem8vbxx" path="res://Effects/GrassEffect.png" id="1"]
[ext_resource type="Script" path="res://Effects/Effect.gd" id="2"]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="1"]
atlas = ExtResource("1")
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 1 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="2"]
atlas = ExtResource("1")
region = Rect2(32, 0, 32, 32)
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 1 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="3"]
atlas = ExtResource("1")
region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 1 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="4"]
atlas = ExtResource("1")
region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 1 )
region = Rect2( 128, 0, 32, 32 )
[sub_resource type="AtlasTexture" id="5"]
atlas = ExtResource("1")
region = Rect2(128, 0, 32, 32)
[sub_resource type="SpriteFrames" id=6]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "Animate",
[sub_resource type="SpriteFrames" id="6"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("1")
}, {
"duration": 1.0,
"texture": SubResource("2")
}, {
"duration": 1.0,
"texture": SubResource("3")
}, {
"duration": 1.0,
"texture": SubResource("4")
}, {
"duration": 1.0,
"texture": SubResource("5")
}],
"loop": false,
"name": &"Animate",
"speed": 15.0
} ]
}]
[node name="GrassEffect" type="AnimatedSprite2D"]
frames = SubResource( 6 )
animation = "Animate"
sprite_frames = SubResource("6")
animation = &"Animate"
frame = 1
frame_progress = 0.606911
centered = false
offset = Vector2( -8, -8 )
script = ExtResource( 2 )
offset = Vector2(-8, -8)
script = ExtResource("2")
[connection signal="animation_finished" from="." to="." method="_on_animation_finished"]

View File

@ -1,31 +1,39 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=7 format=3 uid="uid://bojbqk7e5s22v"]
[ext_resource path="res://Effects/Effect.gd" type="Script" id=1]
[ext_resource path="res://Effects/HitEffect.png" type="Texture2D" id=2]
[ext_resource path="res://Music and Sounds/Hit.wav" type="AudioStream" id=3]
[ext_resource type="Script" path="res://Effects/Effect.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://bah6dkm2id" path="res://Effects/HitEffect.png" id="2"]
[ext_resource type="AudioStream" uid="uid://ce47h2cdpm1l6" path="res://Music and Sounds/Hit.wav" id="3"]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 24, 24 )
[sub_resource type="AtlasTexture" id="1"]
atlas = ExtResource("2")
region = Rect2(0, 0, 24, 24)
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 2 )
region = Rect2( 24, 0, 24, 24 )
[sub_resource type="AtlasTexture" id="2"]
atlas = ExtResource("2")
region = Rect2(24, 0, 24, 24)
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ) ],
"loop": true,
"name": "Animate",
[sub_resource type="SpriteFrames" id="3"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("1")
}, {
"duration": 1.0,
"texture": SubResource("2")
}],
"loop": false,
"name": &"Animate",
"speed": 10.0
} ]
}]
[node name="HitEffect" type="AnimatedSprite2D"]
frames = SubResource( 3 )
animation = "Animate"
offset = Vector2( 0, -8 )
script = ExtResource( 1 )
sprite_frames = SubResource("3")
animation = &"Animate"
offset = Vector2(0, -8)
script = ExtResource("1")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
stream = ExtResource("3")
autoplay = true
[connection signal="animation_finished" from="." to="." method="_on_animation_finished"]