17 lines
378 B
GDScript
17 lines
378 B
GDScript
class_name MortarProjectile
|
|
extends Node3D
|
|
|
|
var velocity: Vector3
|
|
|
|
const GRAVITY := 40.
|
|
|
|
func _process(delta: float) -> void:
|
|
position += velocity * delta
|
|
velocity += GRAVITY * Vector3.DOWN * delta
|
|
|
|
if position.y <= 0.:
|
|
var explosion := preload("res://player/explosion/explosion.tscn").instantiate()
|
|
explosion.position = position
|
|
add_sibling(explosion)
|
|
|
|
queue_free()
|