So i have 4 points, p1,p2,p3 and p4. These move constantly to the left and move back to the far right (window width + 100) whenever they reach too far left (x-100)
. Their Y is random.
I also have lines drawn between each point, this makes a fluent "jagged" line moving across the screen (kind of like the CPU Usage chart in windows task manager).
if (p1x < p2x) {
g.drawLine(p1x, p1y, p2x, p2y);
}
if (p2x < p3x) {
g.drawLine(p2x, p2y, p3x, p3y);
}
if (p3x < p4x) {
g.drawLine(p3x, p3y, p4x, p4y);
}
if (p4x < p1x) {
g.drawLine(p4x, p4y, p1x, p1y);
}
I want a dot to have a constant X in the window, but moving with the line in the Y axis, how do I do this?