Im working on a maze game, and cant find out how to detect if the ball hits the walls/lines!
int x;
int y;
int s;
void setup(){
size(500,500);
background(0);
noStroke();
x = 20;
y = 20;
s = 10;
fill(0,0,255);
ellipse(x,y,s,s);
}
void draw(){
background(0);
ellipse(x,y,s,s);
println(mouseX+" "+mouseY);
fill(255);
line(0,45,348,45);
stroke(100);
line(410,46,410,249);
stroke(100);
line(348,45,351,249);
line(288,45,288,357);
line(410,297,410,500);
line(288,358,349,357);
line(349,357,351,298);
line(410,412,289,412);
line(231,412,231,500);
line(289,456,357,456);
line(473,0,473,500);
line(231,357,65,357);
line(473,497,410,497);
line(231,300,231,108);
}
void keyPressed(){
if (key == 'w' || key == 'W') {
y = y - 5;
}
if (key == 's' || key == 'S') {
y = y + 5;
}
if (key == 'a' || key == 'A') {
x = x - 5;
}
if (key == 'd' || key == 'D') {
x = x + 5;
}
x = constrain(x,0,height);
y = constrain(y,0,height);
//https://forum.processing.org/two/discussion/1028/maze
}