Computer Science Canada game |
Author: | akasweety [ Tue Jun 06, 2006 10:27 am ] |
Post subject: | game |
I've been working on a who wants to be a millionaire type game for my final project but i can't get the questions to appear right after another, when the user has clicked on an answer. |
Author: | Eny [ Tue Jun 06, 2006 10:30 am ] |
Post subject: | |
Could you post the code? I know how to do it with key commands, but I'm not sure you'd want that. |
Author: | akasweety [ Wed Jun 07, 2006 9:23 am ] |
Post subject: | game |
my teacher, said i could use procedures, but it's kinda confusing and i tried so many times but it won't work. here's the code thankz alot for your help ![]() [code] var myAnswer : string %Splash Screen %put "" %put "" %put "" %delay (1000) %cls %delay (10) %end for %Screen to get users name %Instructions on how to play the game %Loading Screen %background colour drawfillbox (5, 5, 635, 395, 55) %Boxes to put the answers and question in: a, b, c, d drawfillbox (10, 15, 300, 75, 85) %box a drawfillbox (345, 15, 630, 75, 85) %box b drawfillbox (12, 85, 300, 150, 85) %box c drawfillbox (347, 85, 630, 150, 85) %box d drawfillbox (10, 325, 630, 385, 85) %box to put question in %place letters a, b, c, d in boxes locate (17, 4) color (55) put "a" .. locate (17, 46) color (55) put "b" .. locate (22, 4) color (55) put "c" .. locate (22, 46) color (55) put "d" .. %Question # 1 and options, places in the boxes procedure q1 locate (3, 15) color (7) put "With what character was Lisa in constant competition?" .. locate (18, 15) color (7) put "Melissa" .. %INCORRECT locate (23, 15) color (7) put "Allison" .. %CORRECT locate (18, 60) color (7) put "Sherry" .. %INCORRECT locate (23, 60) color (7) put "Jeanie" .. %INCORRECT end q1 q1 get myAnswer: if myAnswer = "Allison" then cls end if %question # 2 procedure q2 locate (3, 15) color (7) put "What club from springfield got stranded on the island?" .. locate (18, 15) color (7) put "book club" .. %INCORRECT locate (23, 15) color (7) put "Travel Club" .. %INCORRECT locate (18, 60) color (7) put "UN club" .. %CORRECT locate (23, 60) color (7) put "SH club" .. %INCORRECT end q2 q2 %question # 3 procedure q3 locate (3, 15) color (7) put "What was the signa, it was time for Apu's wedding?" .. locate (18, 15) color (7) put "a lotus flower" .. %CORRECT locate (23, 15) color (7) put "lilly wrapped in a lilly pad" .. %INCORRECT locate (18, 60) color (7) put "two attached skulls" .. %INCORRECT locate (23, 60) color (7) put "a silver tongue" .. %INCORRECT end q3 %question #4 procedure q4 locate (3, 15) color (7) put "How much money did bart get when he ate the jagged metal krusty-O?" .. locate (18, 15) color (7) put "$5000" .. %INCORRECT locate (23, 15) color (7) put "$100" .. %INCORRECT locate (18, 60) color (7) put "$500" .. %CORRECT locate (23, 60) color (7) put "$6000" .. %INCORRECT end q4 %question # 5 procedure q5 locate (3, 15) color (7) put "In what part of the Nuclear plant does Homer work?" .. locate (18, 15) color (7) put "Sector 7B" .. %INCORRECT locate (23, 15) color (7) put "Area 7F" .. %INCORRECT locate (18, 60) color (7) put "Sector 7S" .. %INCORRECT locate (23, 60) color (7) put "Sector 7G" .. %CORRECT end q5 %question # 6 procedure q6 locate (3, 15) color (7) put "What was Homer's campain clogan when applied for Sanitation Commissioner?" .. locate (18, 15) color (7) put "We do it for you!" .. %INCORRECT locate (23, 15) color (7) put "We air out your stinkables!" .. %INCORRECT locate (18, 60) color (7) put "I didn't do it!" .. %INCORRECT locate (23, 60) color (7) put "Can't someone else do it!" .. %CORRECT end q6 %question # 7 procedure q7 locate (3, 15) color (7) put "What dotor wanted to keep Itchy and Scartchy on the air" .. locate (18, 15) color (7) put "Dr.Hibert" .. %INCORRECT locate (23, 15) color (7) put "Dr.Nick" .. %INCORRECT locate (18, 60) color (7) put "Dr.Frink" .. %INCORRECT locate (23, 60) color (7) put "Dr.Monroe" .. %CORRECT end q7 %question # 8 procedure q8 locate (3, 15) color (7) put "What famous singer helped to stop whacking day?" .. locate (18, 15) color (7) put "Barry White" .. %CORRECT locate (23, 15) color (7) put "James Brown" .. %INCORRECT locate (18, 60) color (7) put "Tom Jones" .. %INCORRECT locate (23, 60) color (7) put "Micheal Jackson" .. %INCORRECT end q8 %question # 9 procedure q9 locate (3, 15) color (7) put "Who often says worst episode ever ?" .. locate (18, 15) color (7) put "Comic book guy" .. %CORRECT locate (23, 15) color (7) put "Captain McCallistine" .. %INCORRECT locate (18, 60) color (7) put "Krusty the clown" .. %INCORRECT locate (23, 60) color (7) put "Otto" .. %INCORRECT end q9 %question # 10 procedure q10 locate (3, 15) color (7) put "What Fake name did bart use to buy a credit card?" .. locate (18, 15) color (7) put "Bort Simons" .. %INCORRECT locate (23, 15) color (7) put "Ivana Creditcard" .. %INCORRECT locate (18, 60) color (7) put "Santos Al Halper" .. %CORRECT locate (23, 60) color (7) put "John Doe" .. %INCORRECT end q10 % to tell user if the box they clicked on is Correct or Incorrect var x, y, b, c : int c := 0 loop mousewhere (x, y, b) if x > 10 and y > 15 and x < 300 and y < 75 and b = 1 then cls put "CORRECT" elsif x > 345 and y > 15 and x < 630 and y < 75 and b = 1 then cls put "INCORRECT" elsif x > 12 and y > 85 and x < 300 and y < 150 and b = 1 then cls put "INCORRECT" elsif x > 347 and y > 85 and x < 630 and y < 150 and b = 1 then cls put "INCORRECT" end if end loop [/code] |