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():
|
|
|
|
$RayCast2D.target_position = $"..".linear_velocity * 5000
|
|
|
|
$RayCast2D.force_raycast_update()
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
|
|
#global_rotation = $"..".linear_velocity.angle()
|
2024-04-20 09:45:17 -04:00
|
|
|
$RayCast2D.target_position = to_local($"..".linear_velocity * 5000)
|
|
|
|
points[1] = to_local($RayCast2D.get_collision_point())
|
|
|
|
if $RayCast2D.get_collider() != null and ["Player", "Shield" if target_shield else "None"].has($RayCast2D.get_collider().name):
|
2024-04-16 20:29:45 -04:00
|
|
|
visible = true
|
|
|
|
else:
|
|
|
|
visible = false
|