summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Enemies/Statue.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scenes/Entities/Enemies/Statue.gd')
-rw-r--r--Scenes/Entities/Enemies/Statue.gd27
1 files changed, 27 insertions, 0 deletions
diff --git a/Scenes/Entities/Enemies/Statue.gd b/Scenes/Entities/Enemies/Statue.gd
new file mode 100644
index 0000000..7f1231b
--- /dev/null
+++ b/Scenes/Entities/Enemies/Statue.gd
@@ -0,0 +1,27 @@
+extends StaticBody2D
+
+
+var projectile
+
+@onready var ProjectileScene = preload("res://Scenes/Entities/Enemies/Projectile.tscn")
+
+
+func _on_timer_timeout():
+ if projectile:
+ await projectile.tree_exited
+
+ projectile = ProjectileScene.instantiate()
+
+ projectile.tree_exited.connect(func():
+ projectile = null
+ )
+ projectile.hit.connect(func():
+ Global.player.take_damage(1)
+ )
+
+ projectile.global_position = $ProjectileStart.global_position
+ projectile.target = Global.player.position
+ projectile.scale = Vector2(0.75, 0.75)
+ projectile.speed = 60
+
+ get_tree().current_scene.add_child(projectile)