summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Enemies/Statue.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-05-06 16:30:46 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-05-06 16:30:46 +0200
commit276b7664bd4a475a3ca93a682c16b49c504c58f7 (patch)
tree6b8f8cf0e1a82496c1f539e55e26bc078300b23a /Scenes/Entities/Enemies/Statue.gd
parent8c0e8b5bf73caaf2fd6f04fb97b9c13f2970c431 (diff)
update
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)