ape-ame/TrajectoryDisplay.gd
ultrablob 4ea08b1c5f
All checks were successful
CI / build (pull_request) Successful in 2m48s
add eart
2025-02-05 21:15:12 -05:00

18 lines
559 B
GDScript

extends Line2D
@export var target_shield = false
func _ready():
$ShapeCast2D.target_position = $"..".linear_velocity * 1000
$ShapeCast2D.force_shapecast_update()
func _physics_process(delta):
#global_rotation = $"..".linear_velocity.angle()
$ShapeCast2D.target_position = to_local($"..".linear_velocity * 1000)
if $ShapeCast2D.get_collider(0) != null and ["Player", "Shield" if target_shield else "None"].has($ShapeCast2D.get_collider(0).name):
points[1] = to_local($ShapeCast2D.get_collision_point(0))
visible = true
else:
visible = false