Game Questions Not Functioning
Author |
Message |
TruthManifested
|
Posted: Sun Jan 18, 2009 8:52 pm Post subject: Game Questions Not Functioning |
|
|
Greetings!
I appreciate the help received here! I'm working on a major programming assignment, it is due tommorow. I i've gotten the code finished, now I'm having some major problems running it.
Background info:
Essentially, we must program a basic quiz, that asks the user 10 questions (so 10 different screens: Each screen displays a question, and 4 multiple choice options - one being the answer). Now, my problem is this: As I execute (run) the code, the initial animation comes up sucessfully (many rings popping out from the middle in a definite pattern). After this, the introduction screen comes up with a Chemistry picture as the background. On this screen there are 4 buttons - starting from the left: Start, Exit, Credits, Instructions
Credits, and Instructions both work fine - the problem is with the "start" button. My friend has sucessfully been able to help me somewhat here. Initially, when clicking on the start button, it'd just result in a blank, blue screen coming up - whereas there should have been two difficulty level buttons. We've conquered this problem, now the main one: After clicking on the difficulty level "Normal", nothing comes up. None of the questions/multiple choices (A, B, C, D)...
I've been stuck at this stage for some time, and this is my final day to complete it...I understand that I should have requested help earlier, so lesson learned hehe.
Any last minute help would be greatly appreciated!
Here's the code (the one my friend and I have fixed up a bit):
Turing: | % Program Created by Fahim Faruk
% Created on December __ - December 27th/08
% This is program will generate a quiz that will ask the user questions about
% Fundamental High school Chemistry
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% DECLARING VARIABLES, SETTING UP FONTS, AND OTHER CONSTANT PROCEDURES %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Import GUI and Setscreen
import GUI
setscreen ("graphics:max;max,nobuttonbar,nocursor,noecho")
GUI.SetBackgroundColour (blue)
% 3. Declare Variables
var key : int := 0
var radio : array 1 .. 4 of int
var a, b, c, d : int
var e, f : int
var g, h : int
var i, j : int
var count, count2 : int := 0
var font, font2, font3 : int
var scoreA, scoreB, scoreH, hardUnlock : int := 0
var score, Xitt, x, y, x1, yy : int := 0
var answer : string
var num : string
% Pictures
var mypi : int := Pic.FileNew ("ChemBackground.jpg")
var mypi2 : int := Pic.FileNew ("wrong.jpg")
var mypi3 : int := Pic.FileNew ("right.jpg")
var mypi4 : int := Pic.FileNew ("ques1.jpg")
var mypi5 : int := Pic.FileNew ("ques2.jpg")
var mypi6 : int := Pic.FileNew ("ques3.jpg")
var mypi7 : int := Pic.FileNew ("ques4.jpg")
var mypi8 : int := Pic.FileNew ("ques5.jpg")
var mypi9 : int := Pic.FileNew ("ques6.jpg")
var mypi10 : int := Pic.FileNew ("ques7.jpg")
var mypi11 : int := Pic.FileNew ("ques8.jpg")
var mypi12 : int := Pic.FileNew ("ques9.jpg")
var mypi13 : int := Pic.FileNew ("ques10.jpg")
var mypi14 : int := Pic.FileNew ("ques11.jpg")
var mypi15 : int := Pic.FileNew ("ques12.jpg")
var mypi16 : int := Pic.FileNew ("ques13.jpg")
var mypi17 : int := Pic.FileNew ("ques14.jpg")
var mypi18 : int := Pic.FileNew ("ques15.jpg")
var mypi19 : int := Pic.FileNew ("ques16.jpg")
var mypi20 : int := Pic.FileNew ("ques17.jpg")
var mypi21 : int := Pic.FileNew ("ques18.jpg")
var mypi22 : int := Pic.FileNew ("ques19.jpg")
var mypi23 : int := Pic.FileNew ("ques20.jpg")
% 4. Create Fonts
font := Font.New ("Comicsans:14:bold,italic")
font2 := Font.New ("arial:20:bold")
font3 := Font.New ("arial:30:bold")
% 5. Music and Sound Effects
process trunks
loop
Music.PlayFile ("trunks theme.wav")
end loop
end trunks
process swoosh
Music.PlayFile ("swoosh.wav")
end swoosh
process clap
Music.PlayFile ("Clap.wav")
end clap
process wrong
Music.PlayFile ("wrong.wav")
end wrong
process beep
Music.PlayFile ("Beep.wav")
end beep
process pop
Music.PlayFile ("pop.wav")
end pop
process boo
Music.PlayFile ("boo3.wav")
end boo
fork trunks
% 6. Animation
proc slide
var xmove, ymove : int := 0
fork swoosh
for z3 : 1 .. 130
xmove := xmove + 10
ymove := 50
drawfilloval (xmove, ymove, 150, 50, brightblue)
drawoval (xmove, ymove, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 100, 150, 50, red)
drawoval (xmove, ymove + 100, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 200, 150, 50, green)
drawoval (xmove, ymove + 200, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 300, 150, 50, brightblue)
drawoval (xmove, ymove + 300, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 400, 150, 50, red)
drawoval (xmove, ymove + 400, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 500, 150, 50, green)
drawoval (xmove, ymove + 500, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
drawfilloval (xmove, ymove + 600, 150, 50, brightblue)
drawoval (xmove, ymove + 600, 150, 50, black)
drawline (maxx div 2, maxy div 2, 300, 300, black)
end for
cls
end slide
proc nothing
GUI.Quit
end nothing
proc qquit
quit
end qquit
proc lose
mypi2 := Pic.Scale (mypi2, 1050, 800)
Pic.Draw (mypi2, - 35, - 100, picCopy)
Pic.Free (mypi2 )
end lose
proc winner
mypi3 := Pic.Scale (mypi3, 1050, 800)
Pic.Draw (mypi3, - 35, - 100, picCopy)
Pic.Free (mypi3 )
end winner
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INTRO BUTTON PROCS %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Start Button's Procedure
proc start
fork beep
key := 1
cls
GUI.Quit
cls
end start
% 2. Instruction Button's Procedure
proc ins
fork beep
cls
Font.Draw ("This quiz will test out your knowledge of one of the physical sciences!", 100, maxy - 100, font2, black)
delay (400)
Font.Draw ("You will answer 10 questions related to Chemistry in NORMAL mode.", 90, maxy - 150, font2, black)
delay (400)
Font.Draw ("Each question includes 3 multiple choices, and only one is correct.", 60, maxy - 200, font2, black)
delay (400)
Font.Draw ("If you answer a question correctly, you will be rewarded 100 points!", 98, maxy - 250, font2, black)
delay (400)
Font.Draw ("If you answer a question incorrectly, you will suffer a loss of 50 points", 98, maxy - 300, font2, black)
delay (400)
locate (35, 52)
put "[Press any key to continue]"
loop
exit when hasch
end loop
GUI.Quit
end ins
% 3. Credits Button's Procedure
proc creds
fork beep
%Resets y counter
y := 0
loop
exit when y = 1100
View.Set ("offscreenonly")
Font.Draw ("Quiz Coded/Created by:", 360, y, font3, yellow)
Font.Draw ("Fahim Faruk", 380, y - 40, font3, yellow)
Font.Draw ("Music:", 450, y - 400, font3, yellow)
Font.Draw ("Trunk's Theme From Dragon Ball Z Anime", 190, y - 440, font3, yellow)
Font.Draw ("Zero's Theme, from Megaman X series (game)", 270, y - 480, font3, yellow)
Font.Draw ("Other Sound Effects:", 270, y - 560, font3, yellow)
Font.Draw ("http://www.partnersinrhyme.com/pir/PIRsfx.shtml", 270, y - 600, font3, yellow)
y := y + 1
delay (12)
View.Update
cls
end loop
View.Set ("nooffscreenonly")
GUI.Quit
end creds
% 4. Exit Button's Procedure
proc exit1
GUI.Quit
end exit1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Level of Difficulty and Answers (to Questions) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. Level of difficulty process buttons (down at the introscreen/quiz loop)
proc L1
fork beep
answer := "Normal"
GUI.Quit
end L1
proc L2
fork beep
answer := "Hard"
GUI.Quit
end L2
% 2. Questions (arrays --> Normal - Hard)
% Normal Mode
var question : array 1 .. 10 of string
question (1) := "The two main parts of an atom are the:"
question (2) := "The lowest principle quantum number that an electron can have is:"
question (3) := "The sublevel that has only one orbital is identified by the letter:"
question (4) := "Which of the following displays the correct balancing of the chemical equation: zinc + sulfuric acid --> zinc sulfate + hydrogen (g)?"
question (5) := "The components of the atomic structure are?"
question (6) := "A metallic oxide placed in water would most likely yield a(n):"
question (6) := "A foam is an example of?"
question (7) := "A substance that can be further simplified may either be:"
question (8) := "A substance composed of TWO or MORE elements chemically united is called:"
question (9) := "An example of a chemical change is the:"
% Hard Mode
var question2 : array 1 .. 10 of string
question (1) := "Distillation of water cannot remove?"
question (2) := "The ratio in water of hydrogen to oxygen by mass is?"
question (3) := "Decomposing water by an electric current will give a ratio of hydrogen to oxygen by volume equal to?"
question (4) := "If 10 g of ice melts at 0 degrees C, the totaly quantity of heat absorbed is?"
question (5) := "The gram-equivalent mass of ALCL3 is its gram-formula mass divided by??"
question (6) := "The energy of a system can be:"
question (7) := "The solubility of a solute must indicate:"
question (8) := "The extent of ionization depends on the:"
question (9) := "Which of the following is TRUE?"
question (10) := "The hydronium ion is represented as:"
% 3. Correct Answer's Array
var ansNormal : array 1 .. 10 of string :=
init ("Nucleas and energy levels", "2", "s", "Zn + H2SO4 --> ZnSO4 + H2(g)", "Electron, Proton, Neutron", "Base", "A gas dispersed in a liquid", "Mixture or a compound", "Compound",
"Rusting of Iron")
var ansHard : array 1 .. 10 of string :=
init ("Volatile liquids (ex. Alcohol)", "1:8", "2:1", "80 cal", "1", "Transformed to different form", "ALL OF THESE", "ALL OF THESE", "Total '+' charge = Total '-' charge", "H3O+")
% 4. Correct Answer Process
proc correct
cls
fork clap
score := score + 100
Font.Draw ("YES!", 310, maxy - 50, font2, purple)
Font.Draw ("+100 POINTS!", 310, maxy - 100, font, purple)
Font.Draw ("Congrads!", 310, maxy - 300, font2, purple)
delay (2000)
GUI.Quit
end correct
% 5. Incorrect Answer Process
proc incorrect
cls
fork boo
score := score - 50
lose
Font.Draw ("NOPE!", 310, maxy - 50, font, black)
Font.Draw ("-50 POINTS!", 310, maxy - 150, font, black)
Font.Draw (question (x ), 20, maxy - 150, font, black)
Font.Draw ("Answer: ", 5, maxy - 300, font, black)
case answer of
label "Normal" :
Font.Draw (ansNormal (x ), 250, maxy - 300, font2, purple)
label "Hard" :
Font.Draw (ansHard (x ), 250, maxy - 300, font2, purple)
end case
loop
exit when hasch
end loop
GUI.Quit
end incorrect
% 6. Each choice/option is given an answer ('init' -> assigns every 'string value' in order from 1 - 10)
% The 'values' 1 - 10 are used with questions 1 - 10, so each 'string value' correlates with a question
% Ex. Question 1. Choice A(1) will be displayed (Nucleus and kernal)
% Choice A
var t1 : array 1 .. 10 of string :=
init ("Nucleus and kernal", "0", "s", "2Zn + H2SO4 --> 3ZnSO4 + H2(g)", "Ions, and Electrons", "Acid", "A liquid dispersed in gas", "An atom or molecule", "An element", "Glass breaking")
var t2 : array 1 .. 10 of string :=
init ("Volatile Liquids (ex. Alcohol)", "1:9", "2:1", "14 cal", "6", "Transformed to different form", "The quantity of solvent", "Nature of the solvent", "The positive ions are called cathodes",
"HOH+")
% Choice B
var k1 : array 1 .. 10 of string :=
init ("Planetary Electrons", "2", "p", "Zn + H2SO4 --> ZnSO4 + H2(g)", "Electron, Proton, Neutron", "Base", "A gas dispersed in liquid", "A molecule or solution", "Hydrogen", "Water boiling")
var k2 : array 1 .. 10 of string :=
init ("Dissolved salts", "1:8", "4:1", "10 cal", "1", "Easily changed to mass", "The temperature of solution", "Nature of the solute", "The positive ions are called anions", "H2O+")
% Choice C
var j1 : array 1 .. 10 of string :=
init ("Nucleus and energy levels", "1", "d", "32Zn + H2SO4 --> 3ZnSO4 + 2H2(g)", "Principal energy levels", "Metallic anhydride", "A solid dispersed in a liquid", "Mixture or compound",
"Compound", "Rusting of Iron")
var j2 : array 1 .. 10 of string :=
init ("Suspensions", "2:1", "1:8", "80 cal", "4", "measured only as kinetic energy", "The quantity of solute", "Concentration of the solution", "# of '+' ions in solution = # of '-' ions", "H3O+")
% Choice D
var n1 : array 1 .. 10 of string :=
init ("Nucleus", "7", "p2", "4Zn + H2SO4 --> 3ZnSO4 + H2(g)", "Ions, Neutrons and Electrons", "Oxyacid", "A solid dispersed in gas", "An atom or mixture", "A mechanical mixture", "Paper tearing")
var n2 : array 1 .. 10 of string :=
init ("Precipitates", "1:2", "1:2", "800", "10", "measured only as potential energy", "ALL OF THESE", "ALL OF THESE", "Total '+' charge = Total '-' charge", "H-")
% 7. When each choice is right
%(assign when choice 1 is 'right'. eg. label '3' means choice 1 is correct on question 3)
% Choice A
proc w1
fork beep
case answer of
label "Normal" :
case x of
label 3, 7, 9 :
correct
label :
incorrect
end case
label "Hard" :
case x of
label 1, 3, 6 :
correct
label :
incorrect
end case
end case
end w1
% Choice B
proc w2
fork beep
case answer of
label "Normal" :
case x of
label 2, 4, 5, 6 :
correct
label :
incorrect
end case
label "Hard" :
case x of
label 2, 5 :
correct
label :
incorrect
end case
end case
end w2
% Choice C
proc w3
fork beep
case answer of
label "Normal" :
case x of
label 1, 8, 9, 10 :
correct
label :
incorrect
end case
label "Hard" :
case x of
label 4, 10 :
correct
label :
incorrect
end case
end case
end w3
% Choice D
proc w4
fork beep
case answer of
label "Normal" :
case x of
label 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 :
incorrect
end case
label "Hard" :
case x of
label 7, 8, 9 :
correct
label :
incorrect
end case
end case
end w4
var picNormal : array 1 .. 10 of int
var picHard : array 1 .. 10 of int
% 8. Converts the questions and answers of easy into medium or hard when chosen
proc convert
GUI.Refresh
loop
exit when GUI.ProcessEvent
end loop
cls
case answer of
label "Normal" :
picNormal (1) := Pic.FileNew ("mypi4")
picNormal (2) := Pic.FileNew ("mypi5")
picNormal (2) := Pic.Scale (picNormal (2), 600, 500)
picNormal (3) := Pic.FileNew ("mypi6")
picNormal (3) := Pic.Scale (picNormal (3), 400, 500)
picNormal (4) := Pic.FileNew ("mypi7")
picNormal (4) := Pic.Scale (picNormal (4), 600, 500)
picNormal (5) := Pic.FileNew ("mypi8")
picNormal (5) := Pic.Scale (picNormal (5), 600, 500)
picNormal (6) := Pic.FileNew ("mypi9")
picNormal (6) := Pic.Scale (picNormal (6), 500, 500)
picNormal (7) := Pic.FileNew ("mypi10")
picNormal (7) := Pic.Scale (picNormal (7), 600, 500)
picNormal (8) := Pic.FileNew ("mypi11")
picNormal (8) := Pic.Scale (picNormal (8), 600, 500)
picNormal (9) := Pic.FileNew ("mypi12")
picNormal (9) := Pic.Scale (picNormal (9), 500, 500)
picNormal (10) := Pic.FileNew ("mypi13")
picNormal (10) := Pic.Scale (picNormal (10), 400, 500)
label "Hard" :
question := question2
t1 := t2
k1 := t2
j1 := t2
n1 := t2
picHard (x ) := picNormal (x )
picNormal (1) := Pic.FileNew ("mypi14")
picNormal (1) := Pic.Scale (picNormal (1), 400, 500)
picNormal (2) := Pic.FileNew ("mypi15")
picNormal (2) := Pic.Scale (picNormal (2), 700, 500)
picNormal (3) := Pic.FileNew ("mypi16")
picNormal (3) := Pic.Scale (picNormal (3), 400, 500)
picNormal (4) := Pic.FileNew ("mypi17")
picNormal (4) := Pic.Scale (picNormal (4), 600, 500)
picNormal (5) := Pic.FileNew ("mypi18")
picNormal (5) := Pic.Scale (picNormal (5), 600, 500)
picNormal (6) := Pic.FileNew ("mypi19")
picNormal (6) := Pic.Scale (picNormal (6), 500, 500)
picNormal (7) := Pic.FileNew ("mypi20")
picNormal (7) := Pic.Scale (picNormal (7), 600, 500)
picNormal (8) := Pic.FileNew ("mypi21")
picNormal (8) := Pic.Scale (picNormal (8), 600, 500)
picNormal (9) := Pic.FileNew ("mypi22")
picNormal (9) := Pic.Scale (picNormal (9), 600, 500)
picNormal (10) := Pic.FileNew ("mypi23")
picNormal (10) := Pic.Scale (picNormal (10), 700, 500)
end case
end convert
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Intro Screeen %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fork beep
% 1. Set Background Colour and Font Colour
colorback (blue)
cls
loop
/*Xitt := 0
score := 0
x := 0
% 2. Numerous Oval-Shaped Rings
loop
exit when count = 1000
count := count + 1
randint (a, 0, maxx)
randint (b, 0, maxy)
randint (e, 0, maxx)
randint (f, 0, maxy)
randint (g, 0, maxx)
randint (h, 0, maxy)
randint (i, 0, maxx)
randint (j, 0, maxy)
randint (c, 0, maxx div 2)
randint (d, 0, maxy div 2)
drawoval (maxx div 2, maxy div 2, e, f, blue)
drawoval (maxx div 2, maxy div 2, a, b, yellow)
drawoval (maxx div 2, maxy div 2, g, h, blue)
drawoval (maxx div 2, maxy div 2, i, j, 62)
drawoval (maxx div 2, maxy div 2, i, j, purple)
delay (7)
end loop*/
% 2. Create Black Tunnel-Like Effect
/*for blah : 1 .. 1
drawfilloval (maxx div 2, maxy div 2, 50, 50, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 100, 100, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 150, 150, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 200, 200, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 250, 250, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 300, 300, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 350, 350, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 400, 400, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 450, 450, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 500, 500, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 550, 550, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 600, 600, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 650, 650, black)
delay (40)
drawfilloval (maxx div 2, maxy div 2, 700, 700, black)
delay (50)
end for*/
% 3. Determine Font and Font Contents
Font.Draw ("Prepare Yourself!", maxx div 2 - 150, maxy div 2 - 35, font, white)
delay (2000)
% 4. Determine Font and Font Contents + Create Intro Buttons (Enter and Exit)
loop
key := 0
loop
exit when key = 1
Pic.Draw (mypi, maxx div 200, maxy div 200, picCopy)
Font.Draw ("THE CHEMISTRY QUIZ", maxx div 2 - 200, maxy div 2 - 10, font3, white)
var take : int := GUI.CreateButtonFull (maxx div 2 - 400, 10, 118, "Start", start, 0, '^x', true)
var exxit : int := GUI.CreateButtonFull (maxx div 2 - 200, 10, 0, "Exit!", exit1, 0, '^x', true)
var cred : int := GUI.CreateButtonFull (maxx div 2, 10, 0, "Credits!", creds, 0, '^x', true)
var instructions : int := GUI.CreateButtonFull (maxx div 2 + 200, 10, 0, "Instructions!", ins, 0, '^x', true)
loop
exit when GUI.ProcessEvent
end loop
GUI.ResetQuit
GUI.Dispose (take )
GUI.Dispose (exxit )
GUI.Dispose (cred )
GUI.Dispose (instructions )
end loop
var scoreN : int
% 5. Difficulty level
var Normal : int := GUI.CreateButtonFull (90, 100, 100, "Normal", L1, 70, '^x', true)
var hardF : int := GUI.CreateButtonFull (800, 100, 100, "Hard", L2, 70, '^x', true)
scoreN := 0
scoreH := 0
loop
exit when GUI.ProcessEvent
end loop
GUI.Dispose (Normal )
GUI.Dispose (hardF )
var o : int := 0
% 6. Questions (loop)
loop
exit when o = 10
o := o + 1
num := intstr (o )
Pic.Draw (picNormal (o ), 300, 10, picCopy)
Font.Draw ("Question", 20, maxy - 50, font, black)
Font.Draw (num, 210, maxy - 50, font, black)
Font.Draw (question (o ), 20, maxy - 140, font2, black)
delay (200)
fork pop
var choice1 : int := GUI.CreateButtonFull (10, 450, 100, "a", w1, 10, '^x', true)
delay (200)
fork pop
var choice2 : int := GUI.CreateButtonFull (10, 350, 100, "b", w2, 10, '^x', true)
delay (200)
fork pop
var choice3 : int := GUI.CreateButtonFull (10, 250, 100, "c", w3, 10, '^x', true)
delay (200)
fork pop
var choice4 : int := GUI.CreateButtonFull (10, 150, 100, "d", w4, 10, '^x', true)
GUI.ResetQuit
loop
exit when GUI.ProcessEvent
end loop
% Call slide animation
slide
% Dispose buttons
GUI.Dispose (choice1 )
GUI.Dispose (choice2 )
GUI.Dispose (choice3 )
GUI.Dispose (choice4 )
end loop
% 4. Calculate score
View.Set ("offscreenonly")
var l : int := 0
var percent : real := 0
percent := score / 1000 * 100
num := intstr (score )
Font.Draw ("YOUR SCORE IS :", 330, maxy - 80, font, black)
delay (1000)
Font.Draw (num, 470, maxy - 200, font, black)
View.Set ("nooffscreenonly")
Font.Draw ("YOUR PERCENTAGE IS :", 270, maxy - 400, font, black)
delay (1000)
num := realstr (percent, 0)
Font.Draw (num, 470, maxy - 500, font, black)
Font.Draw ("%", 550, maxy - 500, font, black)
case answer of
label "normal" :
scoreN := scoreN + score
label "hard" :
scoreH := scoreH + score
end case
delay (4000)
slide
if scoreN > 500 then
winner
Font.Draw ("CONGRATULATIONS! YOU HAVE JUST UNLOCKED HARD MODE!!!", 50, maxy - 50, font2, green)
Pic.Draw (mypi4, 300, 10, picCopy)
elsif scoreN > 500 then
winner
elsif scoreH > 500 then
winner
Font.Draw ("CONGRATULATIONS! YOU ARE OFFICIALLY A Chemist!!!", 100, maxy - 50, font2, green)
else
mypi2 := Pic.FileNew ("wrong.jpg")
mypi2 := Pic.Scale (mypi2, 1050, 800)
Pic.Draw (mypi2, - 35, - 100, picCopy)
Pic.Free (mypi2 )
Font.Draw ("Tisk tisk...go do your chem homework!", 255, maxy - 50, font2, green)
end if
% Asks if the user wants to replay the game.
Font.Draw ("Choose: Replay or quit?", 310, maxy - 310, font2, black)
GUI.ResetQuit
var continue : int := GUI.CreateButtonFull (300, 100, 100, "REPLAY", nothing, 100, '^x', true)
var qquitt : int := GUI.CreateButtonFull (550, 100, 100, "QUIT", qquit, 100, '^x', true)
loop
exit when GUI.ProcessEvent
end loop
GUI.Dispose (continue )
GUI.Dispose (qquitt )
end loop
end loop |
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
TruthManifested
|
Posted: Sun Jan 18, 2009 8:56 pm Post subject: Re: Game Questions Not Functioning |
|
|
Note: when I take out "Pic.Draw (picNormal (o), 300, 10, picCopy)"
- The first question comes up, but none of the actual multiple choice options (only the letters, i.e. a, b, c, d - but not the actual choices that are with each letter)
Also, the background picture (different one for each question) does not come up either. |
|
|
|
|
|
|
|