lots of updates (really need to work on atomic commits)
This commit is contained in:
parent
c718935902
commit
4945aeb799
25 changed files with 237 additions and 119 deletions
|
@ -2,17 +2,23 @@ extends Line2D
|
|||
|
||||
@export var target_shield = false
|
||||
|
||||
func _ready():
|
||||
$ShapeCast2D.target_position = $"..".linear_velocity * 1000
|
||||
$ShapeCast2D.force_shapecast_update()
|
||||
const PLAY_AREA = Rect2(0, 0, 1920, 1080)
|
||||
|
||||
@onready var player = $"/root/Node2D/Player"
|
||||
|
||||
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))
|
||||
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)
|
||||
visible = true
|
||||
else:
|
||||
visible = false
|
||||
|
||||
#queue_redraw()
|
||||
|
||||
#func _draw() -> void:
|
||||
#
|
||||
#draw_line(Vector2.ZERO, to_local(global_position + get_parent().linear_velocity), Color.RED)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue