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.

DarkBASIC Professional Discussion / Program Structure

Author
Message
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 26th Aug 2010 02:37
My game that I am working on covers a lot of different topics involving Spanish grammar. I'm getting close to finishing the framework for the first part, and need to make another (then another, and another, etc.) Basically, it is a bunch of "mini games".

My questions is: what is the best way to structure it? Should I create a loading menu, then have each "game" be a subroutine (GOSUB, right?) or is there something different I should do?

Also, for high score tables, I need to learn to open and save to files, correct? Here is what I have so far:



www.dustinmcmurry.com
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Aug 2010 09:23 Edited at: 26th Aug 2010 09:29
I would make the main program loop the main menu showing each mini-game and use that to call each mini-game function. Functions would keep all variables separate from each other mini-game and they could return the score achieved by the player.



It would be easier to show you TDKs tutorial on file access which will cover all you need to learn to save/load files.

http://forum.thegamecreators.com/?m=forum_view&t=96084&b=7

Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 26th Aug 2010 16:59
Take a look at 'EXECUTE EXICUATBLE'

The fastest code is the code never written.
Igglepud
15
Years of Service
User Offline
Joined: 14th Aug 2010
Location:
Posted: 27th Aug 2010 02:04
Thanks. That is a good example. Do all functions need to be named "something()"? And I am slowly trudging through TDK's manual...takes me a while, but I'm glad to have it.

www.dustinmcmurry.com
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Aug 2010 06:29 Edited at: 27th Aug 2010 06:30
Np. Yeah all functions have to have a name and the parentheses. You can put variables within the parentheses to send information into the function too.



In the above code snip it picks two random numbers and uses a and b to store the numbers. The function is called with a and b. Inside the function a is now Num1 and b is now Num2. If you printed out a and b inside the function they would be zero... outside of the function a and b are the random numbers picked.

Think of functions as custom commands you can create yourself. They take any number and string, change them as you see fit, and return the results to the line that called the function or not return anything if you don't need the function to.

Login to post a reply

Server time is: 2026-07-23 12:10:37
Your offset time is: 2026-07-23 12:10:37