fleshy mines
This commit is contained in:
parent
b90bcda166
commit
4ad5c1877e
5 changed files with 37 additions and 18 deletions
Binary file not shown.
Before Width: | Height: | Size: 527 B After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 4.4 KiB |
File diff suppressed because one or more lines are too long
|
@ -4,6 +4,7 @@ const Explosion = preload("res://objects/enemy/explosion.tscn")
|
||||||
|
|
||||||
onready var chain = $Chain
|
onready var chain = $Chain
|
||||||
onready var hitbox = $Hitbox
|
onready var hitbox = $Hitbox
|
||||||
|
onready var respawn_time: float = 1.0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var ground_cast = $GroundCast
|
var ground_cast = $GroundCast
|
||||||
|
@ -19,10 +20,22 @@ func _on_Hitbox_area_entered(area):
|
||||||
var timer = get_tree().create_timer(0.2, false)
|
var timer = get_tree().create_timer(0.2, false)
|
||||||
timer.connect("timeout", self, "die")
|
timer.connect("timeout", self, "die")
|
||||||
if area.is_in_group("player_hitbox"):
|
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()
|
die()
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
var explosion = Explosion.instance()
|
if blood:
|
||||||
explosion.global_position = hitbox.global_position
|
var death_particles = DeathParticles.instance()
|
||||||
get_parent().call_deferred("add_child", explosion)
|
death_particles.global_position = hitbox.global_position
|
||||||
queue_free()
|
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
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ tracks/1/keys = {
|
||||||
|
|
||||||
[node name="Mine" type="Node2D"]
|
[node name="Mine" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
blood = false
|
|
||||||
|
|
||||||
[node name="GroundCast" type="RayCast2D" parent="."]
|
[node name="GroundCast" type="RayCast2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue