Hi,
I’m trying to create a very simple game where the player is given a choice between two buttons in every level, get it right and you move on get it wrong and the word “WRONG” flashes on the screen, but every time I click Start it immediately goes to the End screen. Does anyone know why this is happening?
Here’s what I have so far:
boolean Start = true;
boolean Level1 = false;
boolean Level2 = false;
boolean Level3 = false;
boolean End = false;
void setup()
{
size(900,900);
background(0);
fill(150,240,156);
textSize(150);
text("ESCAPE",195,125);
fill(173,165,165);
rect(280,150,260,80,10);
fill(150,240,156);
textSize(100);
text("Start",300,225);
}
void mousePressed()
{
if (mouseX>=280 && mouseX<=540 && mouseY>=150 && mouseY<=230);
{
Level1=!Level1;
}
if (mouseX>=80 && mouseX<=180 && mouseY>=720 && mouseY<=800);
{
if (Level1);
{
Level2=!Level2;
}
if (Level2)
{
End=!End;
}
}
if (mouseX>=500 && mouseX<=810 && mouseY>=720 && mouseY<=800);
{
if(Level1)
{
fill(150,240,156);
textSize(125);
text("WRONG",300,680);
}
if(Level2)
{
fill(150,240,156);
textSize(125);
text("WRONG",300,680);
}
}
}
void draw()
{
if (Level1)
{
background(0);
fill(150,240,156);
textSize(40);
text("You wake up in a room with a locked door. The lock on the door is RUSTY and one wall is made of loose BRICKS.",25,80,850,240);
fill(171,176,174);
rect(80,720,150,80,10);
fill(150,240,156);
textSize(50);
text("Lock",80,780);
fill(171,176,174);
rect(500,720,150,80,10);
fill(150,240,156);
textSize(50);
text("Bricks",500,765);
}
if(Level2)
{
background(0);
fill(150,240,156);
textSize(40);
text("There is no new doors, only ivy covering the walls, there are a pair of scissors on the floor, you cannot see the ceiling.",25,80,850,240);
fill(171,176,174);
rect(80,745,150,80,10);
fill(150,240,156);
textSize(50);
text("Climb",84,787);
fill(171,176,174);
rect(500,745,150,80,10);
fill(150,240,156);
textSize(50);
text("Clip",500,787);
}
if(End)
{
background(0);
fill(150,240,156);
textSize(150);
text("YOU WON!",95,340);
}
}