ape-ame/TrajectoryDisplay.gd

19 lines
559 B
GDScript3
Raw Normal View History

2024-04-16 20:29:45 -04:00
extends Line2D
2024-04-20 09:45:17 -04:00
@export var target_shield = false
2024-04-16 20:29:45 -04:00
func _ready():
2025-02-05 14:05:36 -05:00
$ShapeCast2D.target_position = $"..".linear_velocity * 1000
$ShapeCast2D.force_shapecast_update()
2024-04-16 20:29:45 -04:00
func _physics_process(delta):
#global_rotation = $"..".linear_velocity.angle()
2025-02-05 14:05:36 -05:00
$ShapeCast2D.target_position = to_local($"..".linear_velocity * 1000)
2025-02-05 21:15:12 -05:00
2025-02-05 14:05:36 -05:00
if $ShapeCast2D.get_collider(0) != null and ["Player", "Shield" if target_shield else "None"].has($ShapeCast2D.get_collider(0).name):
2025-02-05 21:15:12 -05:00
points[1] = to_local($ShapeCast2D.get_collision_point(0))
2024-04-16 20:29:45 -04:00
visible = true
else:
visible = false