line to line Collisions
in
Programming Questions
•
5 months ago
Hi!
I made a program that draw 2 lines and they are not suppose to cross each other, but they do (if you run the program several times you'll see) and when they do it stops and there is a black circle appears))) That's funny, but what I did wrong here?
float x1=180;
float y1=400;
float x11=220;
float y11=400;
void setup() {
size(400, 400);
background(200);
}
void draw () {
float x2=x1+random(-10, 10);
float y2=y1-random(5);
line(x1, y1, x2, y2);
x1=x2;
y1=y2;
float x22=x11+random(-10,10);
float y22=y11-random(5);
line(x11, y11, x22, y22);
x11=x22;
y11=y22;
}
1