Added explosion on laser destroy

This commit is contained in:
2024-05-12 22:14:37 +01:00
parent 750f21bdac
commit 6b69380e85
10 changed files with 220 additions and 28 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ enum {
INVULNERABLE
}
signal brick_destroyed(brick : StaticBody2D)
signal brick_destroyed(brick : StaticBody2D, is_laser : bool )
var hits : int = 1
var value : int = 100
@@ -22,7 +22,7 @@ func _ready() -> void:
func _process(_delta) -> void:
pass
func hit(power : int) -> void:
func hit(power : int, is_laser : bool = false) -> void:
if hits <= 0:
return
hits -= power
@@ -33,7 +33,7 @@ func hit(power : int) -> void:
visible = false
get_tree().create_timer(5).timeout.connect(_show_block)
return
brick_destroyed.emit(self)
brick_destroyed.emit(self, is_laser)
get_parent().call_deferred("remove_child", self)
call_deferred("queue_free")
else: