Computer Science Canada Randomizing/If Statement Help |
Author: | P-Nut311 [ Tue Dec 14, 2004 11:11 pm ] | ||
Post subject: | Randomizing/If Statement Help | ||
I'm making a game similar to 'Who Wants To Be A Millionaire'. First, the player inputs his/her name, then the program asks what subject they want the game to be based on (1. History, 2. Science....). How do I make it so that if the user inputs '1' for history, the game will display only the history questions. If the user inputs '2', then the game will only show science questions.... Also, in this game there are 2 milestones, which are like checkpoints (indicators that once you pass a milestone, the questions will be more difficult). Questions 1 - 5 will be beginner questions, 6 - 10 will be moderate, and 11 - 15 will be difficult. Now, how do I make it so that questions 1 - 5 will be randomized, 6 - 10 will be randomized, and 11 - 15 will be randomized? I want them to be in their own difficulty range (example: question 2 cannot be found at question 12.) How would I do this if my program covers several different subjects (history, science...) but depends on what the user inputs for his/her subject. I'm bad at explaining things, so maybe you'd get a better idea if I just post the code I have so far. Note that the resolution is kinda off, so ignore that for now.
|
Author: | Cervantes [ Tue Dec 14, 2004 11:37 pm ] |
Post subject: | |
Files will be your friend for this undertaking. |
Author: | wtd [ Wed Dec 15, 2004 1:39 pm ] | ||
Post subject: | |||
You might notice that you're repeating this a lot:
Don't. |
Author: | P-Nut311 [ Wed Dec 15, 2004 2:13 pm ] |
Post subject: | |
y??? |
Author: | Mazer [ Wed Dec 15, 2004 3:05 pm ] |
Post subject: | |
Because you only need to do it once. You create the font with that line (probably nearer to the beginning of the code) and you just use that variable each time you're using Font.Draw. You can only make up to 1000 fonts (might be a different number but that's what it is for pictures). After that the program will crash. |
Author: | Tony [ Wed Dec 15, 2004 3:06 pm ] |
Post subject: | |
P-Nut311 wrote: y???
Well when every 4th line of code creates another instance of the same font... that is just beyond redundant ![]() |