2024-04-16 20:29:45 -04:00
|
|
|
extends Line2D
|
|
|
|
|
2024-04-20 09:45:17 -04:00
|
|
|
@export var target_shield = false
|
|
|
|
|
2025-02-09 09:33:36 -05:00
|
|
|
const PLAY_AREA = Rect2(0, 0, 1920, 1080)
|
|
|
|
|
|
|
|
@onready var player = $"/root/Node2D/Player"
|
2024-04-16 20:29:45 -04:00
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
|
|
#global_rotation = $"..".linear_velocity.angle()
|
2025-02-05 21:15:12 -05:00
|
|
|
|
2025-02-09 09:33:36 -05:00
|
|
|
var poi = Geometry2D.segment_intersects_segment(player.global_position, player.global_position + player.linear_velocity, global_position, global_position + get_parent().linear_velocity)
|
|
|
|
|
|
|
|
if poi != null and PLAY_AREA.has_point(poi):
|
|
|
|
set_point_position(1, Vector2.RIGHT * 1000)
|
2024-04-16 20:29:45 -04:00
|
|
|
visible = true
|
|
|
|
else:
|
|
|
|
visible = false
|
2025-02-09 09:33:36 -05:00
|
|
|
|
|
|
|
#queue_redraw()
|
|
|
|
|
|
|
|
#func _draw() -> void:
|
|
|
|
#
|
|
|
|
#draw_line(Vector2.ZERO, to_local(global_position + get_parent().linear_velocity), Color.RED)
|