Quiz Code
Code.
Planning: I wanted to make a Geogrpahy quiz using country outlines with 4 options per question and 3 modes: Easy, Normal, and Hard mode. I finished three of the modes.
I made the quiz completely on my own through trial and error. The first thing I did was learn how to bind buttons with screens so the user could see if they got it wrong in Easy mode. The Normal Mode I used an On Event in the Ui controls and for each button I made sure it would show up if it was correct or incorrect right away and I put a timer on the set screen so the user could see if they got it right before the screen changed to the next question. I also added an info about why I created it. I also made a Settings page were they could press the music button to turn off and on the music if they wanted to listen to it while taking the quiz. I tried to make each mode as far as code be more and more difficult to code and more complex. I did it all myself and it took about 6 hours.
onEvent("Play", "click", function(event) {
setScreen("screen1");
});
onEvent("Info", "click", function(event) {
setScreen("screen20");
});
onEvent("back", "click", function(event) {
setScreen("HomePage");
});
onEvent("easy", "click", function(event) {
setScreen("screen2");
playSound("sound://category_achievements/peaceful_win_1.mp3", false);
});
onEvent("hard", "click", function(event) {
setScreen("screen12");
playSound("sound://category_achievements/melodic_win_1.mp3", false);
});
onEvent("normal", "click", function(event) {
setScreen("screen7");
playSound("sound://category_explosion/melodic_loss_6.mp3", false);
});
onEvent("italy", "click", function(event ) {
setScreen("screen3");
});
onEvent("netherlands", "click", function(event) {
setScreen("screen18");
});
onEvent("germany", "click", function(event) {
setScreen("screen18");
});
onEvent("france", "click", function(event) {
setScreen("screen18");
});
onEvent("incorrect", "click", function(event) {
setScreen("HomePage");
});
onEvent("UK", "click", function(event) {
setScreen("screen4");
});
onEvent("Ireland", "click", function(event) {
setScreen("screen18");
});
onEvent("Australia", "click", function(event) {
setScreen("screen18");
});
onEvent("Spain", "click", function(event) {
setScreen("screen18");
});
onEvent("SK", "click", function(event) {
setScreen("screen5");
});
onEvent("NK", "click", function(event) {
setScreen("screen18");
});
onEvent("Japan", "click", function(event) {
setScreen("screen18");
});
onEvent("China", "click", function(event) {
setScreen("screen18");
});
onEvent("Canada", "click", function(event) {
setScreen("screen18");
});
onEvent("Brazil", "click", function(event) {
setScreen("screen6");
});
onEvent("Mexico", "click", function(event) {
setScreen("screen18");
});
onEvent("USA", "click", function(event) {
setScreen("screen18");
});
onEvent("India", "click", function(event) {
setScreen("screen21");
});
onEvent("Egypt", "click", function(event) {
setScreen("screen18");
});
onEvent("Russia", "click", function(event) {
setScreen("screen18");
});
onEvent("Bang", "click", function(event ) {
setScreen("screen18");
});
onEvent("end", "click", function(event) {
setScreen("HomePage");
});
onEvent("Malay", "click", function(event) {
showElement("rightt");
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
setScreen("screenchile");
}, 2000);
});
onEvent("Philli", "click", function(event) {
showElement("wrongg");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screenchile");
}, 2000);
});
onEvent("NZ", "click", function(event) {
showElement("wrongg");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screenchile");
}, 2000);
});
onEvent("Indo", "click", function(event) {
showElement("wrongg");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screenchile");
}, 2000);
});
onEvent("chile", "click", function(event) {
showElement("rightt2");
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
setScreen("screen9");
}, 2000);
});
onEvent("ecuador", "click", function(event) {
showElement("wrongg2");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen9");
}, 2000);
});
onEvent("suriname", "click", function(event) {
showElement("wrongg2");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen9");
}, 2000);
});
onEvent("peru", "click", function(event) {
showElement("wrongg2");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen9");
}, 2000);
});
onEvent("pakistan", "click", function(event ) {
showElement("righttTwo");
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
setScreen("swiss");
}, 2000);
});
onEvent("Iran", "click", function(event) {
showElement("wronggtwo");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("swiss");
}, 2000);
});
onEvent("Iraq", "click", function(event) {
showElement("wronggtwo");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("swiss");
}, 2000);
});
onEvent("Saudi", "click", function(event ) {
showElement("wronggtwo");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("swiss");
}, 2000);
});
onEvent("swis", "click", function(event ) {
showElement("rightt3");
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
setScreen("screen11");
}, 2000);
});
onEvent("Czechia", "click", function(event) {
showElement("wrongg3");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen11");
}, 2000);
});
onEvent("Hungary", "click", function(event) {
showElement("wrongg3");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen11");
}, 2000);
});
onEvent("romania", "click", function(event) {
showElement("wrongg3");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("screen11");
}, 2000);
});
onEvent("tanzania", "click", function(event) {
showElement("rightt4");
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
setScreen("HomePage");
}, 2000);
});
onEvent("morocco", "click", function(event) {
showElement("wrongg4");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("HomePage");
}, 2000);
});
onEvent("repofcongo", "click", function(event) {
showElement("wrongg4");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("HomePage");
}, 2000);
});
onEvent("zimbabwe", "click", function(event) {
showElement("wrongg4");
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
setScreen("HomePage");
}, 2000);
});
onEvent("Settings1", "click", function(event) {
setScreen("screen22");
});
onEvent("Back2", "click", function(event) {
setScreen("HomePage");
});
onEvent("Musicc", "click", function(event) {
playSound("sound://category_background/gametime.mp3", false);
textLabel("Musicc", "Hi");
});
var Hardscore = 0;
onEvent("Cape", "click", function(event) {
Hardscore = Hardscore+1;
setProperty("zero", "text", Hardscore);
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
showElement("button1");
showElement("button2");
showElement("button3");
showElement("button4");
showElement("image26");
hideElement("Sey");
hideElement("Mauritius");
hideElement("Maldives");
hideElement("Cape");
hideElement("image14");
}, 2000);
});
onEvent("Sey", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button1");
showElement("button2");
showElement("button3");
showElement("button4");
showElement("image26");
hideElement("Sey");
hideElement("Mauritius");
hideElement("Maldives");
hideElement("Cape");
hideElement("image14");
}, 2000);
});
onEvent("Mauritius", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button1");
showElement("button2");
showElement("button3");
showElement("button4");
showElement("image26");
hideElement("Sey");
hideElement("Mauritius");
hideElement("Maldives");
hideElement("Cape");
hideElement("image14");
}, 2000);
});
onEvent("Maldives", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button1");
showElement("button2");
showElement("button3");
showElement("button4");
showElement("image26");
hideElement("Sey");
hideElement("Mauritius");
hideElement("Maldives");
hideElement("Cape");
hideElement("image14");
}, 2000);
});
onEvent("button8", "click", function(event) {
Hardscore = Hardscore+1;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button9");
showElement("button10");
showElement("button11");
showElement("button12");
showElement("image28");
hideElement("button5");
hideElement("button6");
hideElement("button7");
hideElement("button8");
hideElement("image27");
}, 2000);
});
onEvent("button3", "click", function(event) {
Hardscore = Hardscore+1;
setProperty("zero", "text", Hardscore);
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
showElement("button5");
showElement("button6");
showElement("button7");
showElement("button8");
showElement("image27");
hideElement("button1");
hideElement("button2");
hideElement("button3");
hideElement("button4");
hideElement("image26");
}, 2000);
});
onEvent("button1", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button5");
showElement("button6");
showElement("button7");
showElement("button8");
showElement("image27");
hideElement("button1");
hideElement("button2");
hideElement("button3");
hideElement("button4");
hideElement("image26");
}, 2000);
});
onEvent("button2", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button5");
showElement("button6");
showElement("button7");
showElement("button8");
showElement("image27");
hideElement("button1");
hideElement("button2");
hideElement("button3");
hideElement("button4");
hideElement("image26");
}, 2000);
});
onEvent("button4", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button5");
showElement("button6");
showElement("button7");
showElement("button8");
showElement("image27");
hideElement("button1");
hideElement("button2");
hideElement("button3");
hideElement("button4");
hideElement("image26");
}, 2000);
});
onEvent("button5", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button9");
showElement("button10");
showElement("button11");
showElement("button12");
showElement("image28");
hideElement("button5");
hideElement("button6");
hideElement("button7");
hideElement("button8");
hideElement("image27");
}, 2000);
});
onEvent("button6", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button9");
showElement("button10");
showElement("button11");
showElement("button12");
showElement("image28");
hideElement("button5");
hideElement("button6");
hideElement("button7");
hideElement("button8");
hideElement("image27");
}, 2000);
});
onEvent("button7", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button9");
showElement("button10");
showElement("button11");
showElement("button12");
showElement("image28");
hideElement("button5");
hideElement("button6");
hideElement("button7");
hideElement("button8");
hideElement("image27");
}, 2000);
});
onEvent("button9", "click", function(event) {
Hardscore = Hardscore+1;
setProperty("zero", "text", Hardscore);
playSound("sound://category_male_voiceover/correct_male.mp3", false);
setTimeout(function() {
showElement("button13");
showElement("button14");
showElement("button15");
showElement("button16");
showElement("image29");
hideElement("button9");
hideElement("button10");
hideElement("button11");
hideElement("button12");
hideElement("image28");
}, 2000);
});
onEvent("button10", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button13");
showElement("button14");
showElement("button15");
showElement("button16");
showElement("image29");
hideElement("button9");
hideElement("button10");
hideElement("button11");
hideElement("button12");
hideElement("image28");
}, 2000);
});
onEvent("button11", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button13");
showElement("button14");
showElement("button15");
showElement("button16");
showElement("image29");
hideElement("button9");
hideElement("button10");
hideElement("button11");
hideElement("button12");
hideElement("image28");
}, 2000);
});
onEvent("button12", "click", function(event) {
Hardscore = Hardscore+0;
setProperty("zero", "text", Hardscore);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
setTimeout(function() {
showElement("button13");
showElement("button14");
showElement("button15");
showElement("button16");
showElement("image29");
hideElement("button9");
hideElement("button10");
hideElement("button11");
hideElement("button12");
hideElement("image28");
}, 2000);
});
onEvent("button13", "click", function(event) {
Hardscore = Hardscore+0;
setTimeout(function() {
setProperty("zero", "text", Hardscore);
setProperty("Scoree", "font-size", 60);
setProperty("zero", "font-size", 60);
setProperty("zero", "y", 150);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
hideElement("button16");
hideElement("button15");
hideElement("button14");
hideElement("button13");
hideElement("image29");
showElement("zzzz");
hideElement("label12");
hideElement("image9");
}, 2000);
});
onEvent("button14", "click", function(event) {
Hardscore = Hardscore+1;
setTimeout(function() {
setProperty("zero", "text", Hardscore);
setProperty("Scoree", "font-size", 60);
setProperty("zero", "font-size", 60);
setProperty("zero", "y", 150);
playSound("sound://category_male_voiceover/correct_male.mp3", false);
hideElement("button16");
hideElement("button15");
hideElement("button14");
hideElement("button13");
hideElement("image29");
showElement("zzzz");
hideElement("label12");
hideElement("image9");
}, 2000);
});
onEvent("button15", "click", function(event) {
Hardscore = Hardscore+0;
setTimeout(function() {
setProperty("zero", "text", Hardscore);
setProperty("Scoree", "font-size", 60);
setProperty("zero", "font-size", 60);
setProperty("zero", "y", 150);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
hideElement("button16");
hideElement("button15");
hideElement("button14");
hideElement("button13");
hideElement("image29");
showElement("zzzz");
hideElement("label12");
hideElement("image9");
}, 2000);
});
onEvent("button16", "click", function(event) {
Hardscore = Hardscore+0;
setTimeout(function() {
setProperty("zero", "text", Hardscore);
setProperty("Scoree", "font-size", 60);
setProperty("zero", "font-size", 60);
setProperty("zero", "y", 150);
playSound("sound://category_female_voiceover/wrong_female.mp3", false);
hideElement("button16");
hideElement("button15");
hideElement("button14");
hideElement("button13");
hideElement("image29");
showElement("zzzz");
hideElement("label12");
hideElement("image9");
}, 2000);
});
onEvent("zzzz", "click", function( ) {
setScreen("screen1");
});