From 0abec8156bd944aa883d544850ee1187219ba943 Mon Sep 17 00:00:00 2001 From: Lucas Fryzek Date: Tue, 17 Sep 2024 22:02:33 +0100 Subject: Initial commit --- scripts/bullet.gd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/bullet.gd (limited to 'scripts/bullet.gd') diff --git a/scripts/bullet.gd b/scripts/bullet.gd new file mode 100644 index 0000000..93c119a --- /dev/null +++ b/scripts/bullet.gd @@ -0,0 +1,17 @@ +extends Node3D + +var target: Vector3 + +var bullet_speed = 100.0 + +# Called when the node enters the scene tree for the first time. +#func _ready() -> void: +# pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + position = position.move_toward(target, bullet_speed * delta) + + if (target - position).length_squared() <= 2: + queue_free() -- cgit