Initial Idea

Quiz based on Fortnite: Battle Royale Layout - 3 simple multiple choice questions: 1 welcome screen, 3 question screens, 1 ending screen

  • = correct answer

Q1: What year did Fortnite: Battle Royale release?

A: 1776 B: 2015 C: 2017* D: 2018

Q2: Which is the vehicle which drops off players?

A: Reboot Van B: Battle Bus* C: Helicopter D: Shopping cart

Q3: What weapons do you start off with upon spawning?

A: Pick-axe* B: Scar C: Pistol D: Shotguns

Final quiz link

Javascript Code:

hideElement("Start_Button");
var score = 0;
console.log(score);
showElement("Start_Button");
playSound("loadingmusic.mp3", true);
var name = prompt("What's your name?");
onEvent("Start_Button", "click", function(change_screen) {
  setScreen("question1");
});
onEvent("Option1A", "click", function(option1aclick) {
  setScreen("question2");
  score = score + 1;
  console.log(score);
});
onEvent("Option1B", "click", function(option1bclick) {
  setScreen("INCORRECT");
  onEvent("NextQuestion", "click", function( ) {
    setScreen("question2");
  });
});
onEvent("Option1C", "click", function(option1cclick) {
  setScreen("INCORRECT");
  onEvent("NextQuestion", "click", function( ) {
    setScreen("question2");
  });
});
onEvent("Option1D", "click", function(option1dclick) {
  setScreen("INCORRECT");
  onEvent("NextQuestion", "click", function( ) {
    setScreen("question2");
  });
});
onEvent("option2a", "click", function(option2aclick) {
	setScreen("INCORRECT");
	onEvent("NextQuestion", "click", function( ) {
	  setScreen("question3");
	});
});
onEvent("option2b", "click", function(option2bclick) {
  setScreen("question3");
  score = score + 1;
  console.log(score);
});
onEvent("option2c", "click", function(option2cclick) {
  setScreen("INCORRECT");
  onEvent("NextQuestion", "click", function( ) {
    setScreen("question3");
  });
});
onEvent("option2d", "click", function(option2dclick) {
  setScreen("INCORRECT");
  onEvent("NextQuestion", "click", function( ) {
    setScreen("question3");
  });
});
onEvent("option3a", "click", function(option3aclick) {
  stopSound("loadingmusic.mp3");
  setText("VicRoy", "       Eliminated!");
  setScreen("finalscreen");
  setText("text_area1", "Sorry, " + (name + (", but that is sadly incorrect. You answered " + (score + "/3 correct"))));
  playSound("iplayalotof.mp3", true);
});
onEvent("option3b", "click", function(option3bclick) {
  setScreen("finalscreen");
  setText("VicRoy", "Eliminated!");
  setText("text_area1", "Sorry, " + (name + (", but that is sadly incorrect. You answered " + (score + "/3 correct"))));
  stopSound("loadingmusic.mp3");
  playSound("iplayalotof.mp3", true);
});
onEvent("option3c", "click", function(option3cclick) {
  setText("VicRoy", "Eliminated!");
  setScreen("finalscreen");
  setText("text_area1", "Sorry, " + (name + (", but that is sadly incorrect. You answered " + (score + "/3 correct"))));
  stopSound("loadingmusic.mp3");
  playSound("iplayalotof.mp3", true);
});
onEvent("option3d", "click", function(option3dclick) {
  score = score + 1;
  setScreen("finalscreen");
  console.log(score);
  setText("text_area1", "Great Work, " + (name + ("! You answered " + (score + "/3 correct"))));
  stopSound("loadingmusic.mp3");
  playSound("iplayalotof.mp3", true);
});
onEvent("TryAgainButton", "click", function( ) {
  setScreen("WelcomeScreen");
  score = 0;
  stopSound("iplayalotof.mp3");
  playSound("loadingmusic.mp3", true);
  console.log(score);
});

Challenges I faced

I have experience doing block coding, using websites such as scratch or code.org, so I didn't run into many challenges while developing this quiz. With that being said, I did have problems while using an if/else block. My original plan was to make an if else loop for each question. So if the correct answer was chosen, it would move you to the next question. Else, it would take you to the incorrect answer screen. However, using the if blocks was quite difficult and it didn't let me customize the if statement as much as I wanted. So I was forced to use on-event blocks for each and every answer option. This made it harder to code my quiz, and due to this my code is much less efficient.

Ways I could further improve my quiz

The first thing I would do is add some more questions. Next I would randomize the order of the questions to make the quiz harder. I also plan to add more gifs and sound effects for every correct answer. Another big thing that I wanted to change was that On the final screen, I wanted to change the "Epic victory royale" title based on the score, because right now, even if you get 0 answers correct, it still says "Epic victory royale". And lastly, I was also thinking of storing everyones name and score in a dictionary, so I could display a leaderboard for who has the most correct answers.