Game Menu.
              in 
             Programming Questions 
              •  
              7 months ago    
            
 
            
            Hi, Im very new to Processing and i’m trying to make my first game. This isn’t gonna be a good game, i’m just trying to get basic things down. The game is kinda like pong, but worse; its just a ball and u have to press the button at the right time to stop it from flying off the screen. I have absolutely no idea on how to make a game menu for my game so when i press start the game starts, and when the game finishes it goes back there. Here is my code if you need it. 
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
              
             
             
                     
             
             
                
             
             
 
            
           
              float x = 530;
             
             
              float speed = 18;
             
             
              PImage img;
             
             
              void setup(){
             
             
                size (1100, 700);
             
             
                img = loadImage ("space.jpg");
             
             
              }
             
             
              void draw(){
             
             
                background(img);
             
             
                     ellipse(x, 350, 20, 20);
             
             
                    fill(0,255,0); 
             
             
                    if (keyPressed) {
             
             
                  if (key == CODED){
             
             
                    if (keyCode == LEFT){
             
             
                    fill(255, 0, 0); 
             
             
                    rect(0, 250, 15, 200);
             
             
                  }
             
             
                } 
             
             
                if (keyPressed) {
             
             
                  if (key == CODED){
             
             
                    if (keyCode == RIGHT){
             
             
                    fill(0, 0, 255); 
             
             
                    rect(1085, 250, 15, 200);
             
             
                    }
             
             
                  }
             
             
                }
             
             
                  if (keyPressed) {
             
             
                  if (key == CODED){
             
             
                    if (keyCode == LEFT && x <= 30 && x > 0){
             
             
                     speed *= -1;
             
             
                    }
             
             
                  }
             
             
                  }
             
             
                }
             
             
                x = x + speed*2.2;
             
             
                  if (keyPressed) {
             
             
                  if (key == CODED){
             
             
                    if (keyCode == RIGHT && x >= 1070 && x < 1100){
             
             
                     speed *= -1;
             
             
                    }
             
             
                  }
             
             
                  }
             
             
                  }
             
 
            
              
              1  
            
 
            
 
 
          