Trivia Game Help Needed Please!!
Author |
Message |
Yashar343
|
Posted: Wed Jan 15, 2014 1:47 am Post subject: Trivia Game Help Needed Please!! |
|
|
I am trying to make a trivia game that for every question you get right 5 points will be added to your score and for every question you get wrong -5 points will be added. By the end of the game you will be given a bronze,silver, or gold metal based on # of points.?
I can't seem to identify the correct answer of my multiple choice to say that if you have gotten the correct answer then +5 points and vice versa. I have tried to use label in a if statemet but that does not work. I am new in turing and any feedback would be great. ?
Turing: |
var mediumchoice1 : int
locatexy (0, 300)
put "List the planets in order from smallest to biggest."
put "1.Jupiter,Earth,Saturn,Mars,Mercury,Venus,Uranus,Neptune"
put "2.Mercury,Mars,Venus,Earth,Uranus,Neptune,Jupiter,Saturn"
put "3.Mercury,Mars,Venus,Earth,Neptune,Uranus,Saturn,Jupiter"
put "4.Mercury,Venus,Mars,Neptune,Earth,Juptier,Saturn,Venus"
put skip
get mediumchoice1
case mediumchoice1 of
label 1 :
put "Sorry your answer is incorrect, the correct answer was 3.Mercury,Mars,Venus,Earth,Neptune,Uranus,Saturn,Jupiter"
label 2 :
put "Sorry your answer is incorrect, the correct answer was 3.Mercury,Mars,Venus,Earth,Neptune,Uranus,Saturn,Jupiter"
label 3 :
put "Good job your correct"
label 4 :
put "Sorry your answer is incorrect, the correct answer was 3.Mercury,Mars,Venus,Earth,Neptune,Uranus,Saturn,Jupiter"
put skip
end case
%This is the area that i'm having difficulty in.
if mediumchoice1 = correct then
put "excellent job , you get 5 points"
elsif mediumchoice1 = incorrect then
put "sorry you get -5 points"
else
put ""
end if
delay (5000)
cls
|
Turing 4.11 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Wed Jan 15, 2014 8:31 am Post subject: RE:Trivia Game Help Needed Please!! |
|
|
You already detect whether the answer is correct or not in your case-label statement. Why not either:
1) Add or subtract points there.
2) Mark a boolean value for "correct" or "not correct", which you can then refer to later?
Also, you'll save a lot of time and effort if you learn about arrays and file input. You can represent a single question by the following:
- a string for the question itself
- several strings, one for each of the answers
- an integer for the correct answer |
|
|
|
|
|
Yashar343
|
Posted: Wed Jan 15, 2014 8:41 am Post subject: RE:Trivia Game Help Needed Please!! |
|
|
Im a sorry may you please give me an example of 1) adding or substracting points ? |
|
|
|
|
|
DemonWasp
|
Posted: Wed Jan 15, 2014 8:59 am Post subject: RE:Trivia Game Help Needed Please!! |
|
|
How are you storing the player's score / points? Just add or subtract 5 from that number. |
|
|
|
|
|
|
|