Adds better folder structure, and adds simple dialogue system
This commit is contained in:
21
Scenes/Worm/enemy.gd
Normal file
21
Scenes/Worm/enemy.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node2D
|
||||
|
||||
signal enemy_attacked
|
||||
|
||||
func button_pressed():
|
||||
queue_free()
|
||||
|
||||
func _on_first_timer_timeout() -> void:
|
||||
scale = Vector2(1.2,1.2)
|
||||
|
||||
|
||||
func _on_second_timer_timeout() -> void:
|
||||
scale = Vector2(1.4,1.4)
|
||||
|
||||
func _ready() -> void:
|
||||
$AnimatedSprite2D.play("new_animation")
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
enemy_attacked.emit()
|
||||
queue_free()
|
60
Scenes/Worm/enemy.tscn
Normal file
60
Scenes/Worm/enemy.tscn
Normal file
@@ -0,0 +1,60 @@
|
||||
[gd_scene load_steps=8 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"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_5w8q8"]
|
||||
animations = [{
|
||||
"frames": [],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_6av35")
|
||||
}, {
|
||||
"duration": 3.0,
|
||||
"texture": ExtResource("4_x02e0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("5_eqhaj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("6_v8bp8")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"new_animation",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Enemy" type="Node2D" groups=["enemy_group"]]
|
||||
position = Vector2(10, 9)
|
||||
script = ExtResource("1_t2xh1")
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
scale = Vector2(0.4, 0.4)
|
||||
texture = ExtResource("2_qu5u7")
|
||||
|
||||
[node name="FirstTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="SecondTimer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(-22, -55)
|
||||
sprite_frames = SubResource("SpriteFrames_5w8q8")
|
||||
animation = &"new_animation"
|
||||
|
||||
[connection signal="timeout" from="FirstTimer" to="." method="_on_first_timer_timeout"]
|
||||
[connection signal="timeout" from="SecondTimer" to="." method="_on_second_timer_timeout"]
|
||||
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
Reference in New Issue
Block a user