scrump projectile disapear on collision and better disappear graphics (closes #190)
This commit is contained in:
parent
f3d5446d66
commit
1e472333a5
2 changed files with 28 additions and 12 deletions
|
@ -1,10 +1,26 @@
|
|||
extends "res://objects/enemy/enemy.gd"
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
position.x -= 80 * delta
|
||||
var speed: float = 80.0
|
||||
|
||||
func _on_Hitbox_area_entered(area):
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
position.x -= speed * delta
|
||||
|
||||
func _on_Hitbox_area_entered(area: Node) -> void:
|
||||
._on_Hitbox_area_entered(area)
|
||||
if area.is_in_group("player_hitbox"):
|
||||
self.queue_free()
|
||||
_stop()
|
||||
|
||||
|
||||
func _on_Hitbox_body_entered(body: Node) -> void:
|
||||
if body is TileMap:
|
||||
_stop()
|
||||
|
||||
|
||||
func _stop() -> void:
|
||||
speed = 0.0
|
||||
$Hitbox.queue_free()
|
||||
for child in $Particles.get_children():
|
||||
if child is CPUParticles2D:
|
||||
child.emitting = false
|
||||
|
|
|
@ -12,14 +12,16 @@ _data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
|||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 4, 3 )
|
||||
extents = Vector2( 3, 3 )
|
||||
|
||||
[node name="Boss1Projectile" type="Node2D"]
|
||||
z_index = -1
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="GooTrail" type="CPUParticles2D" parent="."]
|
||||
[node name="Particles" type="Node2D" parent="."]
|
||||
position = Vector2( 0, 4 )
|
||||
|
||||
[node name="GooTrail" type="CPUParticles2D" parent="Particles"]
|
||||
z_index = -1
|
||||
local_coords = false
|
||||
texture = ExtResource( 2 )
|
||||
|
@ -33,8 +35,7 @@ angle_random = 1.0
|
|||
scale_amount = 0.5
|
||||
scale_amount_curve = SubResource( 2 )
|
||||
|
||||
[node name="GooBackground" type="CPUParticles2D" parent="."]
|
||||
position = Vector2( 0, 4 )
|
||||
[node name="GooBackground" type="CPUParticles2D" parent="Particles"]
|
||||
amount = 16
|
||||
texture = ExtResource( 1 )
|
||||
emission_shape = 2
|
||||
|
@ -49,8 +50,7 @@ angle_random = 1.0
|
|||
scale_amount = 0.8
|
||||
scale_amount_curve = SubResource( 3 )
|
||||
|
||||
[node name="GooBackgroundFall" type="CPUParticles2D" parent="."]
|
||||
position = Vector2( 0, 4 )
|
||||
[node name="GooBackgroundFall" type="CPUParticles2D" parent="Particles"]
|
||||
amount = 16
|
||||
preprocess = 1.0
|
||||
texture = ExtResource( 1 )
|
||||
|
@ -66,8 +66,7 @@ angle_random = 1.0
|
|||
scale_amount = 0.8
|
||||
scale_amount_curve = SubResource( 3 )
|
||||
|
||||
[node name="GooForeground" type="CPUParticles2D" parent="."]
|
||||
position = Vector2( 0, 4 )
|
||||
[node name="GooForeground" type="CPUParticles2D" parent="Particles"]
|
||||
lifetime = 0.5
|
||||
preprocess = 0.5
|
||||
texture = ExtResource( 3 )
|
||||
|
@ -90,3 +89,4 @@ position = Vector2( 0, 4 )
|
|||
shape = SubResource( 1 )
|
||||
|
||||
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
|
||||
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue