Computer Science Canada Game Screens |
Author: | evogre3n [ Mon Dec 26, 2005 9:09 pm ] | ||||||||||||
Post subject: | Game Screens | ||||||||||||
My upcoming game (Battleship) will be my first game using SWING and such. I am wondering how to create multiple screens... I will have 3 screens.. intro screen main menu screen --> game screens ---> --- back to main menu exit screen And I was thinking of coding each screen in a seperate class, so I will have my main game class, and 3 other classes that will be initialized:
Now, I have to display each screen and I was thinking of doing it something like this: (in the main program after initializing the screen objects (which extends JPanel))
Each screen, (class) will extend JPanel and implement ActionListener, all will contain a field:
which will have one of 2 values
and all will have the accessor
and finally, all will contain a mutator
The mutator for the status will be invoked by the ActionListener.. so when they press "Click to continue" within the intro screen, it will invoke setPanelStatus of intro etc. My question is, am I going about this the right way... or is this overly complicated and there is a simpler way to do it? Thanks a lot |
Author: | evogre3n [ Tue Dec 27, 2005 10:40 am ] |
Post subject: | |
Update: this method doesnt work... i need the main program to constantly check for statechange... I guess that means this is not the right way to go about it.. Anyone have suggestions? Thanks |