summaryrefslogtreecommitdiff
path: root/fireball.gd
diff options
context:
space:
mode:
Diffstat (limited to 'fireball.gd')
-rw-r--r--fireball.gd25
1 files changed, 25 insertions, 0 deletions
diff --git a/fireball.gd b/fireball.gd
new file mode 100644
index 0000000..54ce497
--- /dev/null
+++ b/fireball.gd
@@ -0,0 +1,25 @@
+extends Area2D
+
+var velocity: Vector2
+
+func _ready() -> void:
+ $ShotSound.play()
+
+
+func type() -> String: return "arrow"
+
+
+func damage(other: Area2D) -> void:
+ other.damage(1.5)
+ queue_free()
+ get_node("../BowHit").play()
+
+
+func _physics_process(delta: float) -> void:
+ position += velocity
+ velocity *= 0.9
+ rotation += velocity.length()
+ if velocity.length() < 0.001: queue_free()
+ 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()