I would want a state for the main menu, options screen, each level, game over and the ending.
I'm pretty new to developing games. I currently only have one "level" and I'm accessing it like this
public class StateHub {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.add(new LevelOne());
frame.setVisible(true);
frame.setSize(800, 600);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
For my last game I had a huge series of booleans changing what was drawn to the panel, it got unmanageable fast. Just trying to clean things up. Is there a simple way to turn this into a state-like system where I could do something like destroy the instance of LevelOne and add LevelTwo instead? Is there an easier solution?
Thanks a ton.






