17 lines
429 B
GDScript
17 lines
429 B
GDScript
extends Node3D
|
|
|
|
@export var initial_speed : float
|
|
@export var acceleration : float
|
|
|
|
@onready var current_velocity : float = initial_speed
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
var dir = -get_parent().transform.basis.z
|
|
current_velocity = current_velocity + (acceleration * delta)
|
|
get_parent().velocity = current_velocity * dir
|
|
|
|
if get_parent().move_and_slide():
|
|
get_parent().projectile_collision()
|
|
queue_free()
|
|
|