vuxa bez duxa

This commit is contained in:
2024-10-06 21:08:32 +02:00
parent d92c87bf80
commit feda1c5077
16 changed files with 284 additions and 30 deletions

View File

@@ -67,9 +67,9 @@ func spawn_enemy():
add_child(enemy)
enemy.global_position = global_position
var rotated = randi_range(0, 1)
if(rotated ==1):
enemy.flip_animation()
enemy.global_rotation=rotated*PI
if(rotated == 1):
enemy.mirror()
#enemy.global_rotation=rotated*PI
enemy.enemy_attacked.connect(enemy_attacked)
func enemy_attacked():

View File

@@ -5,21 +5,23 @@ signal enemy_attacked
func button_pressed():
$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("attack")
func flip_animation():
scale.y = -scale.y
func mirror():
scale.x = -scale.x
func _on_animated_sprite_2d_animation_finished() -> void:
if($AnimatedSprite2D.animation == "attack"):
enemy_attacked.emit()
queue_free()
$AnimatedSprite2D.play("attack_2")
return
print_debug($AnimatedSprite2D.animation)
match $AnimatedSprite2D.animation:
"defeated_3", "defeated_2", "defeated_4", "attack_2":
queue_free()
return

View File

@@ -39,23 +39,28 @@ animations = [{
}, {
"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": [{
"duration": 1.0,
"texture": ExtResource("8_ehav7")
}, {
"duration": 1.0,
"texture": ExtResource("7_7om5h")
}, {
"duration": 1.0,
"texture": ExtResource("8_ehav7")
}, {
"duration": 1.0,
"texture": ExtResource("7_7om5h")
}],
"loop": false,
"name": &"attack_2",
"speed": 5.0
}, {
"frames": [],
"loop": true,
"name": &"default",
@@ -70,7 +75,7 @@ animations = [{
}],
"loop": false,
"name": &"defeated_2",
"speed": 8.0
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
@@ -101,7 +106,7 @@ animations = [{
}],
"loop": false,
"name": &"defeated_4",
"speed": 8.0
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
@@ -146,7 +151,7 @@ autostart = true
position = Vector2(-66, -21)
scale = Vector2(0.282227, 0.282227)
sprite_frames = SubResource("SpriteFrames_5w8q8")
animation = &"defeated_4"
animation = &"defeated_2"
[connection signal="timeout" from="FirstTimer" to="." method="_on_first_timer_timeout"]
[connection signal="timeout" from="SecondTimer" to="." method="_on_second_timer_timeout"]