mast3rpyr0
Senior Newbie  Medals: 1
|
 |
«
Posted
2012-03-02 03:37:33 » |
|
I'm starting a project that will start at a login screen, move to a lobby system, and then the game will start. How would you guys go about designing the flow of your application? Would you have a Game class with the main method your game loop and your different menus? Or would you have a MainApplication class, that will only create the window, and have that create a LoginScreen, which calls the Lobby, which calls the Game class?
|
|
|
|
Mads
|
 |
«
Reply #1 - Posted
2012-03-02 03:40:12 » |
|
Usually some kind of handler, that has all of the different screens needed. The application goes back up, and changes what screen to render as it runs.
|
|
|
|
StonePickaxes
|
 |
«
Reply #2 - Posted
2012-03-02 14:09:11 » |
|
I use a statemanager that uses a String "state" and a "setState". When I need to change state (ESC is pressed or something) I simply do 1
| main.setState = "menumain"; |
and in the main method 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| public void tick() { ticks++; this.state = statemanager.state; if ((setState != state) && (!setState.equals("null"))) { if (setState == "quitting") { if (!applet) stop(); if (applet) setState = state; } statemanager.setState(setState); setState = "null"; } |
This just sets the state only if setState is not equal to null and setState does not equal to state. This probably isn't the best way to do it, but it works for me. -Nathan
|
|
|
|
Games published by our own members! Check 'em out!
|
|
ra4king
|
 |
«
Reply #3 - Posted
2012-03-03 02:42:07 » |
|
Don't use == and != to check for String equality!!!!!!!!!! Use the equals(String) method!!!! T______T
Also, why Strings? this will cause your tick and render methods to have loooong if-else statements! It is best to have a class called Screen and then the main class just calls the Screen's update and render methods.
|
|
|
|
StonePickaxes
|
 |
«
Reply #4 - Posted
2012-03-03 02:55:57 » |
|
What would this do to have long if-else statements, and how could it affect rendering? And I changed it to .equals. Forgot for that one.
-Nathan
|
|
|
|
|
sproingie
|
 |
«
Reply #6 - Posted
2012-03-03 03:16:28 » |
|
The first thing .equals() does is check reference equality. Don't try to be smarter than the language, use .equals() to compare strings, period.
|
|
|
|
RylandAlmanza
|
 |
«
Reply #7 - Posted
2012-03-03 03:38:37 » |
|
Don't use == and != to check for String equality!!!!!!!!!! Use the equals(String) method!!!! T______T
Also, why Strings? this will cause your tick and render methods to have loooong if-else statements! It is best to have a class called Screen and then the main class just calls the Screen's update and render methods.
OFFTOPIC:You are the most knowledgeable 16 year old programmer I've ever seen. I just can't get over how you know so many things even though you're only 16! Most 16 year olds use things like game maker or something, and call themselves programmers, but your ability far surpasses mine! (That's not saying much, though, because my ability is pretty bad.) Sorry to go off topic, just wanted to make sure you knew how intelligent you are, lol. 
|
|
|
|
ra4king
|
 |
«
Reply #8 - Posted
2012-03-03 04:02:08 » |
|
Don't use == and != to check for String equality!!!!!!!!!! Use the equals(String) method!!!! T______T
Also, why Strings? this will cause your tick and render methods to have loooong if-else statements! It is best to have a class called Screen and then the main class just calls the Screen's update and render methods.
OFFTOPIC:You are the most knowledgeable 16 year old programmer I've ever seen. I just can't get over how you know so many things even though you're only 16! Most 16 year olds use things like game maker or something, and call themselves programmers, but your ability far surpasses mine! (That's not saying much, though, because my ability is pretty bad.) Sorry to go off topic, just wanted to make sure you knew how intelligent you are, lol.  Hehehe thanks 
|
|
|
|
Cero
|
 |
«
Reply #9 - Posted
2012-03-03 11:11:23 » |
|
just use Enums for states, best practice I tend to use constant ints and stuff, but sometimes I think in C++ terms You are the most knowledgeable 16 year old programmer I've ever seen.
I agree When I was 16 I was probably using BORLAND C++, or maybe still Visual Basic but yeah you can't compare string-values with ==, strings are objects not primitives :>
|
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #10 - Posted
2012-03-03 12:35:04 » |
|
When you think about it, someone 16 years old who started at 7 or 8 has already got the sort of experience that normally triples someone's salary in the real world... start young and you will be an absolute master by the time you're 30. Cas 
|
|
|
|
ReBirth
|
 |
«
Reply #11 - Posted
2012-03-03 12:50:46 » |
|
Don't use == and != to check for String equality!!!!!!!!!! Use the equals(String) method!!!! T______T
Also, why Strings? this will cause your tick and render methods to have loooong if-else statements! It is best to have a class called Screen and then the main class just calls the Screen's update and render methods.
OFFTOPIC:You are the most knowledgeable 16 year old programmer I've ever seen. I just can't get over how you know so many things even though you're only 16! Most 16 year olds use things like game maker or something, and call themselves programmers, but your ability far surpasses mine! (That's not saying much, though, because my ability is pretty bad.) Sorry to go off topic, just wanted to make sure you knew how intelligent you are, lol.  Hehehe thanks  Watchout, we got badass here! Me at 16 still playing VB6. Btt, follow his and Cero's way.
|
|
|
|
StonePickaxes
|
 |
«
Reply #12 - Posted
2012-03-03 15:40:14 » |
|
I apologize for my terrible error with those strings hahaha. I try to always use .equals, but that time I just forgot and it worked so I didn't catch it. I am 17 and started at 12 programming on my TI-83 calculator  -Nathan
|
|
|
|
ra4king
|
 |
«
Reply #13 - Posted
2012-03-03 23:07:26 » |
|
When you think about it, someone 16 years old who started at 7 or 8 has already got the sort of experience that normally triples someone's salary in the real world... start young and you will be an absolute master by the time you're 30.
$$$___$$$
|
|
|
|
BoBear2681
|
 |
«
Reply #14 - Posted
2012-03-04 00:01:21 » |
|
If only you could teach yourself what it takes to be a "consultant" as a teenager...
|
|
|
|
ReBirth
|
 |
«
Reply #15 - Posted
2012-03-04 03:47:15 » |
|
Now ra4king, stay out from facebook and chicks. Back to your desk and work! 
|
|
|
|
ra4king
|
 |
«
Reply #16 - Posted
2012-03-04 04:32:21 » |
|
Nooooooooooooooooooo 
|
|
|
|
|