I've been trying to figure out a way to create separate screens like a title screen, in-game screen, pause screen, etc. I started by just coding everything in the Game class but that got very messy very quickly. Right now I've made each screen its own class and they're gonna be managed by some sort of manager class. I think it will work but i have a feeling i'm doing it all wrong.
Is there a standard way of doing this kind of thing? I have searched but all i seem to find are design patterns that i have no idea how to implement in code.
Changing screen states
Changing screen states
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: Changing screen states
I guess any way works and there's no "real" way to do it.
But if a lot of code is involved you might want to put all the "screens" in separate items and then just use a manager to tell what screen to draw and focus on.
But if a lot of code is involved you might want to put all the "screens" in separate items and then just use a manager to tell what screen to draw and focus on.
ʕ •ᴥ•ʔ
Re: Changing screen states
Thanks lux. Turns out there's actually a design pattern called the State Pattern and it basically is just that. Now i'm struggling with the menu system. I've decided to do the same thing, have each menu item be its own object and be managed by a menu manager object.
I've spent so much time on the background logic i havn't even started a game yet, this is maybe overkill for a first game.
I've spent so much time on the background logic i havn't even started a game yet, this is maybe overkill for a first game.
Musi
There are 10 types of people that understand binary.
Those that do, and those that don't.
There are 10 types of people that understand binary.
Those that do, and those that don't.
Re: Changing screen states
"State Pattern" ...right.
I'd like to see Chili doing a video about it. It's soooooo useful for games and apps. in general.
I'd like to see Chili doing a video about it. It's soooooo useful for games and apps. in general.