feat: add particles to the slime death animation;
This commit is contained in:
@@ -38,6 +38,10 @@ func take_damage():
|
||||
var original_color: Color = Color(1, 1, 1)
|
||||
modulate = original_color
|
||||
if (HP <= 0):
|
||||
$AnimatedSprite2D.hide()
|
||||
$GPUParticles2D.emitting = true
|
||||
await get_tree().create_timer(1).timeout
|
||||
$CollisionShape2D.set_deferred("disabled", true)
|
||||
queue_free()
|
||||
|
||||
func _on_player_detect_area_body_entered(body):
|
||||
|
||||
@@ -156,6 +156,16 @@ animations = [{
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_chgu2"]
|
||||
radius = 60.0
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_chgu2"]
|
||||
particle_flag_disable_z = true
|
||||
spread = 180.0
|
||||
initial_velocity_min = 30.0
|
||||
initial_velocity_max = 60.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
scale_min = 2.0
|
||||
scale_max = 5.0
|
||||
color = Color(0.4745098, 0.72156864, 0.80784315, 1)
|
||||
|
||||
[node name="SlimeEnemy" type="CharacterBody2D" unique_id=384578683]
|
||||
collision_layer = 16
|
||||
motion_mode = 1
|
||||
@@ -163,6 +173,7 @@ script = ExtResource("1_5uyk1")
|
||||
speed = 50
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=627034710]
|
||||
visible = false
|
||||
position = Vector2(0, 2)
|
||||
shape = SubResource("CircleShape2D_3rdvi")
|
||||
|
||||
@@ -172,6 +183,7 @@ animation = &"move_up"
|
||||
autoplay = "default"
|
||||
|
||||
[node name="PlayerDetectArea" type="Area2D" parent="." unique_id=2126126428]
|
||||
visible = false
|
||||
collision_layer = 16
|
||||
collision_mask = 3
|
||||
|
||||
@@ -179,4 +191,11 @@ collision_mask = 3
|
||||
shape = SubResource("CircleShape2D_chgu2")
|
||||
debug_color = Color(0.19248506, 0.64210063, 0, 0.41960785)
|
||||
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="." unique_id=1178350427]
|
||||
emitting = false
|
||||
amount = 60
|
||||
one_shot = true
|
||||
explosiveness = 0.8
|
||||
process_material = SubResource("ParticleProcessMaterial_chgu2")
|
||||
|
||||
[connection signal="body_entered" from="PlayerDetectArea" to="." method="_on_player_detect_area_body_entered"]
|
||||
|
||||
Reference in New Issue
Block a user