title: Making a game in JavaFX8. How can I switch from Splash page to Cutscene to Level?
body: <p>this is my first game using JavaFX so I admittedly have made some bad design decisions, probably. </p>
  
  <p>Anyway, I want to transition from a splash page (Splash class) to a cutscene (Cutscene class) and then to a playable level (PlayableLevel class). The game is launched from my Main class and transitions are supposed to be done with keyboard inputs (Enter button).</p>
  
  <p>The method in Main that starts the game looks like this:</p>
  
  <pre><code>public void start (Stage s) {
          // create your own game here
          Splash splashPage = new Splash();
          Cutscene cs = new Cutscene();
          PlayableLevel play = new PlayableLevel();
          // attach game to the stage and display it
          Scene scene0 = splashPage.init(SIZE, SIZE);
          Scene scene1 = cs.init(SIZE, SIZE, 0);
          Scene scene2 = play.init(SIZE, SIZE, 0);
          s.setScene(scene0);
          s.show();
  
          // sets the game's loop
          KeyFrame frame = new KeyFrame(Duration.millis(MILLISECOND_DELAY),
                                        e -&gt; myGame.step(SECOND_DELAY));
          Timeline animation = new Timeline();
          animation.setCycleCount(Timeline.INDEFINITE);
          animation.getKeyFrames().add(frame);
          animation.play();
      }
  </code></pre>
  
  <p>My question in particular is what should I do to make it so that the Splash class can communicate with the Main class so that once a keystroke event is recorded, the stage can set a new scene? I'm currently reading about EventHandlers but I'm unsure of the exact implementation as of now.</p>
  
  <p>EDIT: One idea I had was to make a linked list of Scenes, and then once some event happens (keystroke), then I would set the scene to the next one in the list. </p>