Quick question I've got.
To this point, I've been working on games with single screens. Simple hangman or pacman type games. You basically have one screen, and information just gets reset or changed and that's it.
*edit* - to clarify - I have sort of worked on "multiple" screens or views; but only in the sense of having a tile based map on screen that when the user moves off in a direction, the array of tiles is redrawn to represent that room. I've never done anything where the layout is entirely different.
However - I now desire to create a game with more than one screen. Let's say a tile game where you've got a map in the top corner and you can click on it to make it full screen - and then exit from it to go back to the game... Or say an inventory screen, or something like that.
My question is - what's the most commonly agreed on practice for doing something like this?
The ways I've thought of so far would be:
-have booleans representing each 'screen' and have an if loop that basically makes the program paint based on this. So perhaps something like:
if (mapEnlarged){
//paint Map
}
else if (inventoryEnlarged){
//paint Inventory
}
else{
//paint main game screen
}
-have multiple JFrames where a new JFrame pops up over the game one (can't see this being a very good idea).
-draw the game in the background still, but draw stuff over it; so, for instance, the game pauses then goes through a loop like it did above, but instead of so many ifs, it just draws the game in the state it's in, and then goes through the if and draws over that.
Those are the routes I can think of. I'd like to finally try something simple. Maybe even just a Main Menu and then the Game Screen. I just really don'y know what the best way to begin on something like this is - since I'm sure there are some major draw backs to different methods, as well as advantage. Perhaps the best method isn't even something I've touched on.
Thanks in advance. I've learned a ton on this forum and I appreciate the help you guys give.
This post has been edited by Atli: 07 February 2012 - 09:35 PM

New Topic/Question
Reply




MultiQuote




|