Fixed animation signals

This commit is contained in:
2026-01-11 17:25:29 +03:00
parent 5314aac33a
commit ff31781087
4 changed files with 29 additions and 23 deletions
+2
View File
@@ -68,4 +68,6 @@ collision_mask = 0
position = Vector2(0, 2)
shape = SubResource("RectangleShape2D_vecdo")
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
[connection signal="animation_looped" from="AnimatedSprite2D" to="." method="_on_animation_looped"]
[connection signal="body_entered" from="PlayerTouchArea" to="." method="_on_player_touch_area_entered"]
+4 -4
View File
@@ -167,6 +167,10 @@ func _rearrange_pickups() -> void:
node.position.y = 0
func _play_look_around_animation() -> void:
sprite.play(ANIMATION_LOOK_AROUND_1 if randi_range(1, 2) == 1 else ANIMATION_LOOK_AROUND_2)
func _on_animation_finished() -> void:
match sprite.animation:
ANIMATION_LOOK_AROUND_1, ANIMATION_LOOK_AROUND_2:
@@ -181,7 +185,3 @@ func _on_animation_looped() -> void:
ANIMATION_IDLE:
if randi_range(1, 100) <= LOOK_AROUND_CHANCE:
_play_look_around_animation()
func _play_look_around_animation() -> void:
sprite.play(ANIMATION_LOOK_AROUND_1 if randi_range(1, 2) == 1 else ANIMATION_LOOK_AROUND_2)
+4
View File
@@ -13,6 +13,7 @@ collision_mask = 113
script = ExtResource("1_xln5q")
[node name="AnimatedSprite2D" parent="." instance=ExtResource("2_n6ad3")]
animation = &"death"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 1)
@@ -34,3 +35,6 @@ one_shot = true
[node name="CoyoteTimeTimer" type="Timer" parent="."]
wait_time = 0.1
one_shot = true
[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animation_finished"]
[connection signal="animation_looped" from="AnimatedSprite2D" to="." method="_on_animation_looped"]
+19 -19
View File
@@ -32,17 +32,6 @@ shader_parameter/scale = 20.0
atlas = ExtResource("6_7erpt")
region = Rect2(0, 360, 640, 360)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_o6y7x"]
resource_local_to_scene = true
shader = ExtResource("7_qqn64")
shader_parameter/black_color = Color(0, 0, 0, 1)
shader_parameter/white_color = Color(1, 1, 1, 1)
shader_parameter/switch_colors = true
shader_parameter/threshold = 0.5
shader_parameter/speed = 5.0
shader_parameter/intensity = 1.0
shader_parameter/scale = 20.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6yudq"]
resource_local_to_scene = true
shader = ExtResource("7_qqn64")
@@ -120,6 +109,17 @@ shader_parameter/speed = 5.0
shader_parameter/intensity = 1.0
shader_parameter/scale = 20.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_nhfvd"]
resource_local_to_scene = true
shader = ExtResource("7_qqn64")
shader_parameter/black_color = Color(0, 0, 0, 1)
shader_parameter/white_color = Color(1, 1, 1, 1)
shader_parameter/switch_colors = true
shader_parameter/threshold = 0.5
shader_parameter/speed = 5.0
shader_parameter/intensity = 1.0
shader_parameter/scale = 20.0
[node name="Level7" instance=ExtResource("1_bhhdo")]
script = ExtResource("2_sh0fj")
@@ -222,7 +222,7 @@ position = Vector2(-77, 0)
animation = &"look_around_front_1"
[node name="Right_3" parent="Cutscene/EnemyWaves/WaveThree" index="2" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_o6y7x")
material = SubResource("ShaderMaterial_6yudq")
position = Vector2(-87, 0)
animation = &"look_around_front_1"
@@ -231,7 +231,7 @@ position = Vector2(-95, 0)
animation = &"look_around_front_1"
[node name="Right_5" parent="Cutscene/EnemyWaves/WaveThree" index="4" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_6yudq")
material = SubResource("ShaderMaterial_8x4ch")
position = Vector2(-104, 0)
animation = &"look_around_front_1"
@@ -245,7 +245,7 @@ position = Vector2(-120, 0)
animation = &"look_around_front_1"
[node name="Left_1" parent="Cutscene/EnemyWaves/WaveThree" index="7" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_8x4ch")
material = SubResource("ShaderMaterial_x83dg")
position = Vector2(78, 0)
animation = &"look_around_front_2"
@@ -254,7 +254,7 @@ position = Vector2(86, 0)
animation = &"look_around_front_2"
[node name="Left_3" parent="Cutscene/EnemyWaves/WaveThree" index="9" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_x83dg")
material = SubResource("ShaderMaterial_jbfb3")
position = Vector2(95, 0)
animation = &"look_around_front_2"
@@ -287,7 +287,7 @@ position = Vector2(156, 0)
animation = &"walk_left"
[node name="Left_3" parent="Cutscene/EnemyWaves/WaveOne" index="2" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_jbfb3")
material = SubResource("ShaderMaterial_n303p")
position = Vector2(168, 0)
animation = &"walk_left"
@@ -296,7 +296,7 @@ position = Vector2(181, 0)
animation = &"walk_left"
[node name="Left_5" parent="Cutscene/EnemyWaves/WaveOne" index="4" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_n303p")
material = SubResource("ShaderMaterial_ghjrb")
position = Vector2(196, 0)
animation = &"walk_left"
@@ -317,7 +317,7 @@ position = Vector2(-131, 0)
animation = &"walk_right"
[node name="Right_2" parent="Cutscene/EnemyWaves/WaveTwo" index="1" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_ghjrb")
material = SubResource("ShaderMaterial_6mp5f")
position = Vector2(-142, 0)
animation = &"walk_right"
@@ -339,7 +339,7 @@ position = Vector2(-188, -1)
animation = &"walk_right"
[node name="Right_7" parent="Cutscene/EnemyWaves/WaveTwo" index="6" instance=ExtResource("11_6yudq")]
material = SubResource("ShaderMaterial_6mp5f")
material = SubResource("ShaderMaterial_nhfvd")
position = Vector2(-200, -1)
animation = &"walk_right"