I need serious help with creating a pong game in processing for my college homework!

Hello everyone!
Im being for help cause today is the deadline of the work a need to delivery.

basically im creating a pong game in processing using java, but im having serious problems with the creation of a menu and some other stuff

i already have the pretty raw of pong, which is the paddles working well with the colliders, and the ball that bounces trough the scenario and the score, reset and gameover/victory sign!

but i need to apply one MENU to this game, and i dont know how to make it, im not sure if it is with how the code was made, but its being very hard for me to make it, wonder if someone can help me out?

int x, y, w, h, speedX, speedY; //x, y, w largura, h altura
int paddleXL, paddleYL, paddleW, paddleH, paddleS;
int paddleXR, paddleYR;

boolean upR, downR;
boolean upL, downL;

color colorL = color(255,0,255);
color colorR = color(0,255,255);

int scoreL = 0;
int scoreR = 0;

int winScore = 2;

void setup() {
size(500,500);
//backgroud(0); (caso queira deixar rastro na bola)

x = width/2;
y = height/2;
w = 30;
h = 30;
speedX = 2;
speedY = 3;

textSize(30);
textAlign(CENTER, CENTER);

rectMode(CENTER);
paddleXL = 40;
paddleYL = height/2;

paddleXR = width-40;
paddleYR = height/2;

paddleW = 20;
paddleH = 100;
paddleS = 5;
}

void draw() {
background(0);

drawCircle(); //Desenho do circulo

moveCircle(); //Velocidade do circulo

bounceOff(); //if e else do circulo (quicar)

drawPaddles();
movePaddle();
restrictPaddle();
contactPaddle();

scores();
gameOver();

}

void contactPaddle() {
//left collision

if(x - w/2 < paddleXL + paddleW/2 && y - h/2 < paddleYL + paddleH/2 && y + h/2 > paddleYL - paddleH/2 ) {
if(speedX < 0) {
speedX = -speedX;
}

}

//right collision
else if(x + w/2 > paddleXR - paddleW/2 && y - h/2 < paddleYR + paddleH/2 && y + h/2 > paddleYR - paddleH/2 ) {
if(speedX > 0) {
speedX = -speedX;
}
}
}
void restrictPaddle() {
if(paddleYL - paddleH/2 < 0) {
paddleYL = paddleYL + paddleS;
}
if(paddleYL + paddleH/2 > height) {
paddleYL = paddleYL - paddleS;
}
if(paddleYR - paddleH/2 < 0) {
paddleYR = paddleYR + paddleS;
}
if(paddleYR + paddleH/2 > height) {
paddleYR = paddleYR - paddleS;
}
}

void keyPressed() {
if(key == ‘w’ || key == ‘W’) {
upL = true;
}
if(key == ‘s’ || key == ‘S’) {
downL = true;
}
if(keyCode == UP) {
upR = true;
}
if(keyCode == DOWN) {
downR = true;
}

}

void keyReleased() {
if(key == ‘w’ || key == ‘W’) {
upL = false;
}
if(key == ‘s’ || key == ‘S’) {
downL = false;
}
if(keyCode == UP) {
upR = false;
}
if(keyCode == DOWN) {
downR = false;
}

}

void drawPaddles(){
fill(colorL);
rect(paddleXL, paddleYL, paddleW, paddleH);
fill(colorR);
rect(paddleXR, paddleYR, paddleW, paddleH);

}

void movePaddle() {
if(upL) {
paddleYL = paddleYL - paddleS;
}
if(downL) {
paddleYL = paddleYL + paddleS;
}

if(upR) {
paddleYR = paddleYR - paddleS;
}
if(downR) {
paddleYR = paddleYR + paddleS;
}
}

void drawCircle() {
fill(255,0,0);
ellipse(x, y, w, h);
}

void moveCircle() {
x = x + speedX;
y = y + speedY;
}

void bounceOff() {
if( x > width - w/2) {
setup();
speedX = -speedX;
scoreL = scoreL +1;

}

else if ( x < 0 + w/2){
setup();
speedX = -speedX;
scoreR = scoreR +1;

}

if( y > height - h/2) {

speedY = -speedY;

}

else if ( y < 0 + h/2) {
speedY = -speedY;
}
}

void scores() {
fill(255);
text(scoreL, 100, 50);
text(scoreR, width-100, 50);

}

void gameOver() {
if(scoreL == winScore) {
gameOverPage(“Roxo venceu!”, colorL);

}
if(scoreR == winScore) {
gameOverPage(“Azul venceu!”, colorR);

}
}

void gameOverPage(String text, color c) {

speedX = 0;
speedY = 0;

text(“Game Over”, width/2, height/4 - 40);
text(text, width/2, height/3);
textSize(25);
text(“Click na tela para jogar novamente”, width/2, height/3 - 40);

if(mousePressed) {
scoreR = 0;
scoreL = 0;
speedX = 2;
speedY = 3;

}

}

this is the code for his own, just the pong. i would be very appreciated if someone could help me out, thank u guysss

Hello and welcome to the forum!

Great to have you here!

Let’s say you have different screens, one for menu, one for victory screen etc.

Make a global variable state that tells you, which screen to display

Switch (state) {

case 0:
//show Menu
...
break; 

case 1:
//show Game (most of what you have in draw() now)
...
break; 

case 2:
//show Victory screen
...
break; 

} // switch

Now, you don’t tell what buttons you want to have in the menu

but you can display a rect() surrounding a text()
and check when the mouse is pressed in the rect. If so, perform an action.
Lot of people make a class Button for this.

Warm regards,

Chrisir