fleshy mines

This commit is contained in:
Haze Weathers 2025-07-17 17:59:46 -06:00
parent b90bcda166
commit 4ad5c1877e
5 changed files with 37 additions and 18 deletions

View file

@ -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

View file

@ -71,7 +71,6 @@ tracks/1/keys = {
[node name="Mine" type="Node2D"]
script = ExtResource( 1 )
blood = false
[node name="GroundCast" type="RayCast2D" parent="."]
visible = false