summaryrefslogtreecommitdiff
path: root/arrow.gd
diff options
context:
space:
mode:
Diffstat (limited to 'arrow.gd')
-rw-r--r--arrow.gd17
1 files changed, 17 insertions, 0 deletions
diff --git a/arrow.gd b/arrow.gd
new file mode 100644
index 0000000..829edd7
--- /dev/null
+++ b/arrow.gd
@@ -0,0 +1,17 @@
+extends Area2D
+
+var velocity: Vector2
+
+
+func type() -> String: return "arrow"
+
+
+func damage(other: Area2D) -> void:
+ other.damage(1)
+ queue_free()
+
+func _physics_process(_delta: float) -> void:
+ position += velocity
+ if position.x < -Globals.WIDTH / 2. or position.y < -Globals.HEIGHT / 2. or \
+ position.x > Globals.WIDTH / 2. or position.y > Globals.HEIGHT / 2.:
+ queue_free()