fleshy mines
This commit is contained in:
parent
b90bcda166
commit
4ad5c1877e
5 changed files with 37 additions and 18 deletions
|
@ -4,6 +4,7 @@ const Explosion = preload("res://objects/enemy/explosion.tscn")
|
|||
|
||||
onready var chain = $Chain
|
||||
onready var hitbox = $Hitbox
|
||||
onready var respawn_time: float = 1.0
|
||||
|
||||
func _ready():
|
||||
var ground_cast = $GroundCast
|
||||
|
@ -19,10 +20,22 @@ func _on_Hitbox_area_entered(area):
|
|||
var timer = get_tree().create_timer(0.2, false)
|
||||
timer.connect("timeout", self, "die")
|
||||
if area.is_in_group("player_hitbox"):
|
||||
var explosion = Explosion.instance()
|
||||
explosion.global_position = hitbox.global_position
|
||||
get_parent().get_parent().call_deferred("add_child", explosion)
|
||||
die()
|
||||
|
||||
func die():
|
||||
var explosion = Explosion.instance()
|
||||
explosion.global_position = hitbox.global_position
|
||||
get_parent().call_deferred("add_child", explosion)
|
||||
queue_free()
|
||||
if blood:
|
||||
var death_particles = DeathParticles.instance()
|
||||
death_particles.global_position = hitbox.global_position
|
||||
death_particles.emitting = true
|
||||
get_parent().get_parent().add_child(death_particles)
|
||||
$Hitbox/Sprite.visible = false
|
||||
hitbox.monitoring = false
|
||||
hitbox.monitorable = false
|
||||
yield(get_tree().create_timer(respawn_time), "timeout")
|
||||
hitbox.monitorable = true
|
||||
hitbox.monitoring = true
|
||||
$Hitbox/Sprite.visible = true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue