I'm trying to do a simple thing, draw a vertical line from a "Player" straight up and its kinda working but there are several issues.
- The line is not full length
- When the character moves the line gets more offset the more you move
- It doesnt originate from player position
Attached to Sprite2D2:
extends Sprite2D
var radius := 400.0
var refrence_vector:Vector2
# Called when the node enters the scene tree for the first time.
func _draw():
draw_line(%Player.global_position,refrence_vector, Color(0,1,1), 2, true)
func _ready():
refrence_vector = Vector2(%Player.global_position.x,%Player.global_position.y+radius)
func _process(delta):
refrence_vector = Vector2(%Player.global_position.x,%Player.global_position.y+radius)
queue_redraw()
I should mention that I have exactly one day of experience.