im making a tycoon game about mining bitcoin, to show the value of bitcoin over time i wanted to use a Line2D as a line graph, the problem is that the graph keeps expanding but the older points dont go away (they exist off screen) im not too sure if this will cause preformance drops at a certain point or if i can just ignore it, but just in case i would like to find a way to clear only the older points of the line 2d
code so far:
var x = 0
var lineX = 0
func _process(delta):
x+=20
$Line2D.add_point(Vector2(x, randi_range(20, 280)), 0)
if x >= 500:
lineX -= 20
$Line2D.position = Vector2(lineX, 0)