title: Enter State error, Slick2d
body: <p>I am creating a flappy bird esque minigame. For some reason there is an error when I try to enter my actual "playing" state from the "menu" state and the "level" state holds it all together, a new error is thrown as it was working before. Any help would be greatly appreciated, thanks!</p>
  
  <p>Level state: holds it all together:</p>
  
  <pre><code>package gamepackage;
  import org.newdawn.slick.*;
  import org.newdawn.slick.state.*;
  
  
  public class level extends StateBasedGame{
      public static final String gamename = "Flight 1.0 ";
      public static final int menu = 0;
      public static final int playing = 1;
  
      public level(String gamename){
          super(gamename);
          this.addState(new Menu(menu));
          this.addState(new Playing(playing));
  
      }
  
  public void initStatesList(GameContainer gc)throws SlickException{
      this.getState(menu).init(gc, this);
      this.getState(playing).init(gc, this);
      this.enterState(menu);
  
  }
  
  public static void main(String args[]){
  
      AppGameContainer appgc;
      try{
          appgc = new AppGameContainer(new level(gamename));
          appgc.setDisplayMode(800, 550, false);
          appgc.start();
  
      }catch(SlickException e){
          e.printStackTrace();
      }
  
  
      }
  
  
  }
  </code></pre>
  
  <p>My Menu State: Is where the player clicks play to enter the "playing" state:</p>
  
  <pre><code>package gamepackage;
  
  
  import org.lwjgl.input.Mouse;
  import org.newdawn.slick.*;
  import org.newdawn.slick.state.*;
  
  public class Menu extends BasicGameState{
      Image play;
       int xpos = Mouse.getX();
          int ypos = Mouse.getY();
      public Menu(int state){
  
  
      }
  
      public void init(GameContainer gc, StateBasedGame sbg)throws SlickException{
          play = new Image("res/play.jpg");
  
      }
      public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException{
  g.drawImage(play, 0, 0);
  
  
      }
  
  public void update(GameContainer gc, StateBasedGame sbg, int delta)throws SlickException{
       Input input = gc.getInput();
  
       if((xpos &gt;= 0 &amp;&amp; xpos &lt;= 127) &amp;&amp; (ypos&gt;= 0 &amp;&amp; ypos &lt;= 33)){
           if(input.isMouseButtonDown(0)){
               sbg.enterState(1);
           }
       }
  
  }
  public int getID(){
      return 0;
  }
  }
  </code></pre>
  
  <p>Playing State, where the gameplay occurs:</p>
  
  <pre><code>package gamepackage;
  import org.newdawn.slick.*;
  import org.newdawn.slick.geom.Rectangle;
  import org.newdawn.slick.state.*;
  public class Playing extends BasicGameState{
  
      Image guy;
      Image bg1;
      Image bg2;
      Image bg3;
      Rectangle pr;
      Rectangle rect1, rect2, rect3, rect4, rect5;
      Rectangle rect1d, rect2d, rect3d, rect4d, rect5d;
  
      float bg1x = 0;
      float bg2x = 800;
      float bg3x = 1600;
  
      float x = 30, y = 90;
      float px = 30, py = y + 160;
  
  
      float rect1x = 1000, rect1y = 0;
      float rect2x = 1250, rect2y = 0;
      float rect3x = 1500, rect3y = 0;
      float rect4x = 1750, rect4y = 0;
      float rect5x = 2000, rect5y = 0;
      float rect1dx = 1000, rect1dy = 300;
      float rect2dx = 1250, rect2dy = 350;
      float rect3dx = 1500, rect3dy = 400;
      float rect4dx = 1750, rect4dy = 350;
      float rect5dx = 2000, rect5dy = 300;
  
  
  
      public Playing(int state){
  
  
      }
  
      public void init(GameContainer gc, StateBasedGame sbg)throws SlickException{
          bg1 = new Image("res/bg1.jpg");
          bg2 = new Image("res/bg2.jpg");
          bg3 = new Image("res/bg3.jpg");
          guy = new Image("res/PlaneMovie1.gif");
  
  
  
      }
      public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException{
  
          g.drawImage(bg1, bg1x, 0);
          g.drawImage(bg2, bg2x, 0);
          g.drawImage(bg1, bg3x, 0);
  
          pr = new Rectangle(240, py, 135, 80);
  
  
          rect1 = new Rectangle(rect1x, rect1y, 50, 100);
          rect1d = new Rectangle(rect1dx, rect1dy, 50, 300);
  
          rect2 = new Rectangle(rect2x, rect2y, 50, 150);
          rect2d = new Rectangle(rect2dx, rect2dy, 50, 300);
  
          rect3 = new Rectangle(rect3x, rect3y, 50, 200);
          rect3d = new Rectangle(rect3dx, rect3dy, 50, 300);
  
          rect4 = new Rectangle(rect4x, rect4y, 50, 150);
          rect4d = new Rectangle(rect4dx, rect4dy, 50, 300);
  
          rect5 = new Rectangle(rect5x, rect5y, 50, 100);
          rect5d = new Rectangle(rect5dx, rect5dy, 50, 300);
  
          g.draw(rect1);
          g.draw(rect1d);
          g.draw(rect2);
          g.draw(rect2d);
          g.draw(rect3);
          g.draw(rect3d);
          g.draw(rect4);
          g.draw(rect4d);
          g.draw(rect5);
          g.draw(rect5d);
          g.drawImage(guy, x, y);
      }
  
  
     public void update(GameContainer gc, StateBasedGame sbg, int delta)throws    SlickException{
  
      Input input = gc.getInput();
  
      if(input.isKeyDown(Input.KEY_SPACE)){   y -= .3 ; py -= .3 ; }
      if(input.isKeyDown(Input.KEY_SPACE) == false){  y += .4; py += .4;}
      if(rect1x == -100){rect1x += 1150; rect1dx += 1150;}
      if(rect2x == -100){rect2x += 1150; rect2dx += 1150;}
      if(rect3x == -100){rect3x += 1150; rect3dx += 1150;}
      if(rect4x == -100){rect4x += 1150; rect4dx += 1150;}
      if(rect5x == -100){rect5x += 1150; rect5dx += 1150;}
  
      //collision detection
      if(pr.intersects(rect1)){ System.out.println("eyyo.");}
  
  
      bg1x -= .20;
      bg2x -= .20;
      bg3x -= .20;
  
   rect1x-= .25;
   rect2x -= .25;
   rect3x -= .25;
  rect4x -= .25;
   rect5x -= .25;
   rect1dx -= .25;
   rect2dx -= .25;
   rect3dx -= .25;
   rect4dx -= .25;
   rect5dx -= .25;
  
  
  
  }
  public int getID(){
      return 1;
  }
  }
  </code></pre>