LD56 is over. This is the game.
This commit is contained in:
20
entities/ants/attackzone.gd
Normal file
20
entities/ants/attackzone.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends Area3D
|
||||
|
||||
signal attack
|
||||
|
||||
func _on_attack_timer_timeout() -> void:
|
||||
var ant := get_parent() as Ant
|
||||
for body in get_overlapping_bodies():
|
||||
if body is Ant:
|
||||
var other_ant := body as Ant
|
||||
if ant is SoldierAnt and other_ant is EnemyAnt:
|
||||
other_ant.hit(randi_range(0, ant.damage))
|
||||
attack.emit()
|
||||
if ant is EnemyAnt and other_ant is not EnemyAnt:
|
||||
other_ant.hit(randi_range(0, ant.damage))
|
||||
attack.emit()
|
||||
for area in get_overlapping_areas():
|
||||
if area.get_parent() is Building:
|
||||
var building := area.get_parent() as Building
|
||||
building.hit(randi_range(0, ant.damage))
|
||||
attack.emit()
|
||||
Reference in New Issue
Block a user