I've been experimenting with using the _draw() function. The plan was to use said function instead of a sprite. However problems have arisen when it comes to matching the location of a rectangle I've drawn to the location of its parent node (and thus the CollisionShape2D). Even when I set them to the exact same vector2 the parent node seems to lag behind the shape. I have used a normal sprite in the below gif to represent the parent node's location (please ignore the second sprite which pops in briefly).
var p1y = 0 #controls the y axis for this paddle
var p1x = 100
onready var main = get_node("../../Main") #main stores global variables such as gamespeed
draw_rect(Rect2 ( self.position, Vector2(20,100) ), Color( 0, 1, 1, 1 ), true)
if (Input.is_action_pressed("p1_up") and (p1y >= 0)): #move up
p1y -= (100*main.getGameSpeed())*delta #move multiplied by gamespeed. We use delta to keep it consistent regardless of framerate.
elif (Input.is_action_pressed("p1_down") and (p1y <= 500)):
p1y += (100*main.getGameSpeed())*delta
self.position = (Vector2(p1x, p1y))
I'm at a bit of a loss in trying to understand what's going on here. Perhaps _process and _draw work on two different systems? Any help would be greatly appreciated. Thanks in advance.