title: Reset button LibGdx
body: <p>I am making a pong game and what i want to do is when the ball goes past the players paddle for the ball to go back to the middle(which i have done) and a button to come up that when we press it the velocity of the ball goes back to how it was (the game restarts).
   what i have already is the game resets when a player scores. Ive added the button and actionlistener but the actionlistener doesnt restart the game. Here is my code:</p>
  
  <pre><code>public void StartAgain(){
          if(resetButton = true){
          int playButtonWidth = ballPong.getBallSizeX();
          int playButtonHeight = ballPong.getBallSizeY();
          ResetButtonStage = new Stage();
          skin = new Skin();
  
          font = new BitmapFont(Gdx.files.internal("font.fnt"), false);
          style = new LabelStyle(font, Color.WHITE);
  
          buttonAtlas = new TextureAtlas("buttons/playButton.pack");
          skin.addRegions(buttonAtlas);
  
  
          playButtonStyle = new TextButtonStyle();
  
          playButtonStyle.up = skin.getDrawable("play");
          playButtonStyle.over = skin.getDrawable("play_pressed");
          playButtonStyle.down = skin.getDrawable("play_pressed");
          playButtonStyle.font = font;
  
          //------------------------------------------------------------------------------- Play button
  
          playButton = new TextButton("", playButtonStyle);
          //buttonStyle.font.setScale((float) 0.5);   
  
          playButton.setWidth(playButtonWidth);
          playButton.setHeight(playButtonHeight);
          playButton.setPosition(100,250);
          ResetButtonStage.addActor(playButton);
  
          playButton.addListener(new InputListener(){
              @Override
              public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                  ballPong.ballVectorX = ballPong.getBallSpeed();
                  ballPong.ballVectorY = ballPong.getBallSpeed();
                  resetButton = false;
                  return true;
              }
          });
  
          Gdx.input.setInputProcessor(ResetButtonStage);
          batch = new SpriteBatch();
  
          ResetButtonStage.act();
          ResetButtonStage.draw();
      }
      }
  </code></pre>
  
  <p>what ive tried to do is create a boolean called resetButton and set it to false, and when a player scores it sets the boolean to true, thus showing the button. However, ive gone about this the wrong way. Ive done it so when the balls position is below the paddle the game resets and the StartAgain() method shows. But obviously the position of the ball is now above the paddle (as it has reset) so the startAgain method wont be running.</p>
  
  <pre><code>if(ballPong.getPosition().y&lt;= 1){
              player2Score = player2Score +1;
              System.out.println("bottom");
              StartAgain();
              resetButton = true;
              if(ballPong.reset ==true){
  
                      ballPong.reset();
              }           
          }
  </code></pre>
  
  <p>What I'm asking is, where should i call this StartAgain() method and how can I get the actionlistener working.</p>