public void setState(States state) {
   if (currentState != null) currentState.dispose();
   if (state == States.Splash) {
     currentState = new SplashState(this);
   }
   if (state == States.Title) {
     currentState = new TitleState(this);
   }
   if (state == States.Play) {
     currentState = new PlayState(this);
   }
   if (state == States.GameOver) {
     currentState = new GameOverState(this);
   }
   if (state == States.Credits) {
     currentState = new CreditsState(this);
   }
 }
 public void dispose() {
   currentState.dispose();
 }