I am new to processing
I am making a maze where you have to press the mouse to see it and i dnt know how to make walls that have collision is there anyone that can help
float x = 5;
float y = 55;
PImage img;
void setup() {
size(600, 597);
img = loadImage( "Maze.jpg" );
}
void draw() {
background(0);
fill(255);
rect(x, y, 10, 10);
fill(0);
rect(0,0,600,47);
rect(0,75,138,27);
rect(0,75,27,597);
rect(0,580,600,27);
rect(560,74,600,597);
rect(505,75,600,30);
}
void keyPressed(){
if (key == CODED) {
if (keyCode == UP) {
y = y - 5;
}
if (keyCode == DOWN) {
y = y + 5;
}
if (keyCode == LEFT) {
x = x - 5;
}
if (keyCode == RIGHT) {
x = x + 5;
}
}
if (key == 'r')
{
x = 5;
y = 55;
}
}
void mousePressed(){
image(img,0,0);
fill(57,56,56);
}