Adds new animations

This commit is contained in:
2024-10-06 19:38:16 +02:00
parent 0f6f75ea44
commit d92c87bf80
69 changed files with 930 additions and 164 deletions

View File

@@ -11,9 +11,12 @@ signal enemy_killed
var trans = false
func _unhandled_input(event: InputEvent) -> void:
if !get_parent().game_active:
return
if(event.is_action_pressed(input_name)):
print_debug(input_name)
$AnimatedSprite2D.play("pressed")
$Splash.play("splash")
var children = get_children(false)
var was_valid_input = false
if(red_button):
@@ -48,10 +51,11 @@ func red_out():
$AnimatedSprite2D.play("red_out")
func _process(delta: float) -> void:
if(!trans):
$AnimatedSprite2D.modulate = color_mix
else:
$AnimatedSprite2D.modulate = Color(1,1,1)
match $AnimatedSprite2D.animation:
"default", "pressed":
$AnimatedSprite2D.modulate = color_mix
_:
$AnimatedSprite2D.modulate = Color(1,1,1)
func spawn_enemy():
if(trans):
@@ -60,11 +64,12 @@ func spawn_enemy():
return
if(randi_range(0,1)==1):
var enemy = ENEMY.instantiate()
print_debug(randf_range(0.0, 2.0) * PI)
add_child(enemy)
enemy.global_position = global_position
enemy.global_rotation=randf_range(0, 2 * PI)
enemy.look_at(global_position)
var rotated = randi_range(0, 1)
if(rotated ==1):
enemy.flip_animation()
enemy.global_rotation=rotated*PI
enemy.enemy_attacked.connect(enemy_attacked)
func enemy_attacked():
@@ -109,4 +114,5 @@ func _on_animated_sprite_2d_animation_finished() -> void:
if(trans):
if($AnimatedSprite2D.animation == "red_out"):
red_button = false
$AnimatedSprite2D.play("default")
trans = false

View File

@@ -1,18 +1,29 @@
[gd_scene load_steps=10 format=3 uid="uid://bhvihrt8dipll"]
[gd_scene load_steps=18 format=3 uid="uid://bhvihrt8dipll"]
[ext_resource type="Script" path="res://Scenes/Button/button.gd" id="1_fkyus"]
[ext_resource type="Texture2D" uid="uid://q85jhjrqsrxk" path="res://Assets/Buttons/Idle.png" id="2_01nlj"]
[ext_resource type="Texture2D" uid="uid://blatwufdrwqml" path="res://Assets/Buttons/PressedIn1.png" id="3_180hi"]
[ext_resource type="Texture2D" uid="uid://4c7qtuk0exng" path="res://Assets/Buttons/FullPressed.png" id="4_5m7c4"]
[ext_resource type="Texture2D" uid="uid://ncd65m8iq7l0" path="res://Assets/Buttons/PressedOut.png" id="5_3xqo8"]
[ext_resource type="Texture2D" uid="uid://chckt1ppwsjq" path="res://Assets/Buttons/FORBIDDEN.png" id="6_p5821"]
[ext_resource type="Texture2D" uid="uid://cw6je7hakttbq" path="res://Assets/Buttons/ERROR.png" id="7_3w6j8"]
[ext_resource type="Texture2D" uid="uid://cmnangp78o1y6" path="res://Assets/Buttons/IMG_3394.png" id="2_jyhi7"]
[ext_resource type="Texture2D" uid="uid://8ce1ggql35ki" path="res://Assets/Buttons/IMG_3403.png" id="3_1lg6b"]
[ext_resource type="Texture2D" uid="uid://e40ep7k06vl7" path="res://Assets/Buttons/IMG_3395.png" id="4_ho636"]
[ext_resource type="Texture2D" uid="uid://cdilvc7bopjtg" path="res://Assets/Buttons/IMG_3393.png" id="5_wgvcg"]
[ext_resource type="Texture2D" uid="uid://cqmf1i4v81bl6" path="res://Assets/Buttons/IMG_3402.png" id="6_lmv6p"]
[ext_resource type="Texture2D" uid="uid://iujiv0je2v1i" path="res://Assets/Explosion/IMG_3416.png" id="7_dr88a"]
[ext_resource type="Texture2D" uid="uid://ba0lrop3un1m5" path="res://Assets/Explosion/IMG_3417.png" id="8_ysgst"]
[ext_resource type="Texture2D" uid="uid://b6vg8rn1eiako" path="res://Assets/Explosion/IMG_3418.png" id="9_gkfcp"]
[ext_resource type="Texture2D" uid="uid://bf4eob20ngfhc" path="res://Assets/Explosion/IMG_3419.png" id="10_dyy7c"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_6vho0"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_gda8k"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_y30w1"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ej84g"]
[sub_resource type="SpriteFrames" id="SpriteFrames_leuex"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_01nlj")
"texture": ExtResource("2_jyhi7")
}],
"loop": false,
"name": &"default",
@@ -20,16 +31,16 @@ animations = [{
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_180hi")
"texture": ExtResource("3_1lg6b")
}, {
"duration": 3.0,
"texture": ExtResource("4_5m7c4")
"duration": 2.0,
"texture": ExtResource("4_ho636")
}, {
"duration": 1.0,
"texture": ExtResource("5_3xqo8")
"texture": ExtResource("3_1lg6b")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
"texture": ExtResource("2_jyhi7")
}],
"loop": false,
"name": &"pressed",
@@ -37,71 +48,101 @@ animations = [{
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6_p5821")
"texture": SubResource("CompressedTexture2D_6vho0")
}, {
"duration": 3.0,
"texture": SubResource("CompressedTexture2D_gda8k")
}, {
"duration": 1.0,
"texture": SubResource("CompressedTexture2D_y30w1")
}, {
"duration": 1.0,
"texture": SubResource("CompressedTexture2D_ej84g")
}],
"loop": true,
"loop": false,
"name": &"pressed_old",
"speed": 15.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("5_wgvcg")
}],
"loop": false,
"name": &"red",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
"texture": ExtResource("6_lmv6p")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
"texture": ExtResource("5_wgvcg")
}, {
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
"texture": ExtResource("6_lmv6p")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
}, {
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
}, {
"duration": 1.0,
"texture": ExtResource("6_p5821")
"texture": ExtResource("5_wgvcg")
}],
"loop": false,
"name": &"red_in",
"speed": 3.0
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
"texture": ExtResource("6_lmv6p")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
"texture": ExtResource("5_wgvcg")
}, {
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
"texture": ExtResource("6_lmv6p")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
}, {
"duration": 1.0,
"texture": ExtResource("7_3w6j8")
}, {
"duration": 1.0,
"texture": ExtResource("2_01nlj")
"texture": ExtResource("5_wgvcg")
}],
"loop": false,
"name": &"red_out",
"speed": 3.0
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_l0l4p"]
radius = 10.4089
[sub_resource type="SpriteFrames" id="SpriteFrames_va6xu"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": null
}, {
"duration": 1.0,
"texture": null
}, {
"duration": 1.0,
"texture": ExtResource("7_dr88a")
}, {
"duration": 1.0,
"texture": ExtResource("8_ysgst")
}, {
"duration": 1.0,
"texture": ExtResource("9_gkfcp")
}, {
"duration": 1.0,
"texture": ExtResource("10_dyy7c")
}, {
"duration": 1.0,
"texture": null
}],
"loop": false,
"name": &"splash",
"speed": 12.0
}]
[node name="Button" type="Node2D"]
script = ExtResource("1_fkyus")
metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(1.38, 1.316)
scale = Vector2(0.267899, 0.255474)
sprite_frames = SubResource("SpriteFrames_leuex")
[node name="Area2D" type="Area2D" parent="."]
@@ -113,6 +154,12 @@ collision_mask = 2
scale = Vector2(4.74125, 4.84)
shape = SubResource("CircleShape2D_l0l4p")
[node name="Splash" type="AnimatedSprite2D" parent="."]
position = Vector2(1, 31)
scale = Vector2(0.348624, 0.348624)
sprite_frames = SubResource("SpriteFrames_va6xu")
animation = &"splash"
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
[connection signal="area_exited" from="Area2D" to="." method="_on_area_2d_area_exited"]

View File

@@ -1,21 +1,25 @@
extends Node2D
signal enemy_attacked
@export var color:Color
func button_pressed():
queue_free()
$AnimatedSprite2D.play("defeated_3")
func _on_first_timer_timeout() -> void:
scale = Vector2(1.2,1.2)
func _process(delta: float) -> void:
$AnimatedSprite2D.modulate=color
func _on_second_timer_timeout() -> void:
scale = Vector2(1.4,1.4)
func _ready() -> void:
$AnimatedSprite2D.play("new_animation")
$AnimatedSprite2D.play("attack")
func flip_animation():
scale.y = -scale.y
func _on_animated_sprite_2d_animation_finished() -> void:
enemy_attacked.emit()
if($AnimatedSprite2D.animation == "attack"):
enemy_attacked.emit()
queue_free()

View File

@@ -1,14 +1,61 @@
[gd_scene load_steps=8 format=3 uid="uid://cuvoq65ec58jk"]
[gd_scene load_steps=18 format=3 uid="uid://cuvoq65ec58jk"]
[ext_resource type="Script" path="res://Scenes/Worm/enemy.gd" id="1_t2xh1"]
[ext_resource type="Texture2D" uid="uid://7a1smbkaiutn" path="res://icon.svg" id="2_qu5u7"]
[ext_resource type="Texture2D" uid="uid://bjb6konwfdwma" path="res://Assets/Worm/1.png" id="3_6av35"]
[ext_resource type="Texture2D" uid="uid://cowon23pejcb6" path="res://Assets/Worm/2.png" id="4_x02e0"]
[ext_resource type="Texture2D" uid="uid://dl0wp6buga4d" path="res://Assets/Worm/3.png" id="5_eqhaj"]
[ext_resource type="Texture2D" uid="uid://c6cj6t3538iox" path="res://Assets/Worm/4.png" id="6_v8bp8"]
[ext_resource type="Texture2D" uid="uid://cex3sifrw1242" path="res://Assets/Worm/1.png" id="3_6av35"]
[ext_resource type="Texture2D" uid="uid://dactqej8ynl64" path="res://Assets/Worm/2.png" id="4_x02e0"]
[ext_resource type="Texture2D" uid="uid://cux4bd7fifyd6" path="res://Assets/Worm/3.png" id="5_eqhaj"]
[ext_resource type="Texture2D" uid="uid://72t1c28fr2nl" path="res://Assets/Worm/4.png" id="6_v8bp8"]
[ext_resource type="Texture2D" uid="uid://cimvprnm3ca2a" path="res://Assets/Worm/5.png" id="7_7om5h"]
[ext_resource type="Texture2D" uid="uid://5ulqrr6hbxm8" path="res://Assets/Worm/6.png" id="8_ehav7"]
[ext_resource type="Texture2D" uid="uid://du2p38ha0txko" path="res://Assets/Worm/2_back.png" id="9_jymta"]
[ext_resource type="Texture2D" uid="uid://brf7f6oxfgebt" path="res://Assets/Worm/3_back.png" id="10_1wx05"]
[ext_resource type="Texture2D" uid="uid://dnwrxihviw0rk" path="res://Assets/Worm/2_back_alt.png" id="11_gy0bh"]
[ext_resource type="Texture2D" uid="uid://uwspas3u4wv1" path="res://Assets/Worm/4_back.png" id="12_gpphe"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ydqfm"]
load_path = "res://.godot/imported/1.png-d59e84433910eecfa2e5220e6ec5b5b4.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ap4lv"]
load_path = "res://.godot/imported/2.png-90fe91be8b8400834bfb6934ea879095.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_prrpc"]
load_path = "res://.godot/imported/3.png-0463e07c1bea2f543f4c3653457283e4.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_3mwge"]
load_path = "res://.godot/imported/4.png-4b049625170874896147063dd9a56363.ctex"
[sub_resource type="SpriteFrames" id="SpriteFrames_5w8q8"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_6av35")
}, {
"duration": 2.0,
"texture": ExtResource("4_x02e0")
}, {
"duration": 2.0,
"texture": ExtResource("5_eqhaj")
}, {
"duration": 4.0,
"texture": ExtResource("6_v8bp8")
}, {
"duration": 1.0,
"texture": ExtResource("7_7om5h")
}, {
"duration": 1.0,
"texture": ExtResource("8_ehav7")
}, {
"duration": 1.0,
"texture": ExtResource("7_7om5h")
}, {
"duration": 1.0,
"texture": ExtResource("8_ehav7")
}],
"loop": false,
"name": &"attack",
"speed": 9.0
}, {
"frames": [],
"loop": true,
"name": &"default",
@@ -16,16 +63,58 @@ animations = [{
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("9_jymta")
}, {
"duration": 1.0,
"texture": ExtResource("3_6av35")
}],
"loop": false,
"name": &"defeated_2",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_1wx05")
}, {
"duration": 1.0,
"texture": ExtResource("11_gy0bh")
}, {
"duration": 1.0,
"texture": ExtResource("3_6av35")
}],
"loop": false,
"name": &"defeated_3",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("12_gpphe")
}, {
"duration": 1.0,
"texture": ExtResource("10_1wx05")
}, {
"duration": 1.0,
"texture": ExtResource("11_gy0bh")
}, {
"duration": 1.0,
"texture": ExtResource("3_6av35")
}],
"loop": false,
"name": &"defeated_4",
"speed": 8.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("CompressedTexture2D_ydqfm")
}, {
"duration": 3.0,
"texture": ExtResource("4_x02e0")
"texture": SubResource("CompressedTexture2D_ap4lv")
}, {
"duration": 1.0,
"texture": ExtResource("5_eqhaj")
"texture": SubResource("CompressedTexture2D_prrpc")
}, {
"duration": 1.0,
"texture": ExtResource("6_v8bp8")
"texture": SubResource("CompressedTexture2D_3mwge")
}],
"loop": false,
"name": &"new_animation",
@@ -33,8 +122,11 @@ animations = [{
}]
[node name="Enemy" type="Node2D" groups=["enemy_group"]]
z_index = 10
y_sort_enabled = true
position = Vector2(10, 9)
script = ExtResource("1_t2xh1")
color = Color(0.610846, 0.557314, 0.897917, 1)
[node name="Icon" type="Sprite2D" parent="."]
visible = false
@@ -51,9 +143,10 @@ one_shot = true
autostart = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(-22, -55)
position = Vector2(-66, -21)
scale = Vector2(0.282227, 0.282227)
sprite_frames = SubResource("SpriteFrames_5w8q8")
animation = &"new_animation"
animation = &"defeated_4"
[connection signal="timeout" from="FirstTimer" to="." method="_on_first_timer_timeout"]
[connection signal="timeout" from="SecondTimer" to="." method="_on_second_timer_timeout"]