Why will start not = true?

I’ve been out of coding for a few months and am trying to get back into it with a platformer. Was working on the backbone, and I can’t make start true with anything! Any ideas?
float playerX;
float playerY;

boolean start;
boolean level1;

void setup(){
fullScreen();
background(106,218,240);
playerX=width/2;
playerY=height/2;
}
void draw(){
if(start==true){
if(mouseX>width/2){
level1=true;
start=false;
}
}
if(level1==true){
fill(245,72,72);
stroke(206,98,98);
strokeWeight(width/800);
square(playerX,playerY,width/10);
}
}

First please format your code for this forum by placing you code between two sets of back-apostrophes like this
```
// the code to format
```

Add this method


void keyTyped(){
  switch(key){
    case 's':
    start = true;
    break;
    // can add other case statements to handle other keys
  }
}

hitting the “s” key will set start true.

1 Like