Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Main loop or other loop?

Author
Message
Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 8th Oct 2009 20:24
So my situation is this, I have a select character/create character screen next to the main game, and I was wondering. Is it better to make extra loops for each of those screens and use an int to check in whitch screen you are. Or is it better to put my check button click functions in my main loop, for both of the screens??

Isocadia

PS: I think it might be better to make seperate loops, and if this is the case, whitch loop I need to use to check keyboard input/ button click????
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 8th Oct 2009 22:46
Just have a variable like "mode" then when the game starts it's mode 0. And in the main loop you have a decision structure to check which mode it is. If it's mode 0 then it does menu things. And if you click the start button or whatever in the menu then you change to mode 1 and do whatever is next in the game.

Your bedtime story is scaring everyone
Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 9th Oct 2009 19:00
Yeah, but what I thought may be speed improvement, was that for my character screen, I used a loop and checked collision with the buttons in there etc. and when you press the enter button. That loop breaks and you go in the main loop so that I only have the game in the main loop, nothing else.

Isocadia

PS: Maybe my way doesn't change anything, but I only would like to know if I do it my way, what is the best loop to use?? While or for or do loops??
Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 9th Oct 2009 19:19
Had to read the post twice to understand it, especially since my bro is speking in phone right next to me xD

Well what i did was the first option but another way, i used bools, but actually lotsa them >.<;

options, instructions, controls, etc.

And i dont really know if my way is the best around here, BUT i'd recommend it

Chamillion

You can only get smarter by playing a smarter opponent.
Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 9th Oct 2009 20:49 Edited at: 9th Oct 2009 20:52
@Chamillion: Well, I thought about using alot of int's and bools for all my option setting etc. But just to know for sure, you are saying that when I start up my game. ScreenStat is 0, and when I get into the game, Screenstat is 1 etc. And in the main loop I just make if statments to check in whitch mode I am and then execute the code that is needed for that screen. And when I switch screens, I change that number so that it goes to the code connected to the other screen??

And already thanks for all your help. This will help me alot.

Isocadia

PS: how do you spell whitch ( like in what kind of tool, whitch tool )??
Chamill
16
Years of Service
User Offline
Joined: 29th Sep 2008
Location:
Posted: 9th Oct 2009 23:02
For starters, u spell it "which".

Yeah I sort of ment that, but as said,i used bools.

In any case its up to u, do whatever u feel suits u best ;D

Chamillion

You can only get smarter by playing a smarter opponent.
Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 10th Oct 2009 09:57
Thanks, never could get that word right. But bools can only contain true or false. But when making screen resolution, I'm not gonna make a bool for every resolution that I'm going to make possible, so for that I'm gonna use int's. But whatever, thank you very much for your help.

Isocadia

Login to post a reply

Server time is: 2024-11-20 13:30:10
Your offset time is: 2024-11-20 13:30:10