Before

  • Gather ideas for what I'm going to make and how
  • Get all resources needed (images, references, etc)
  • Mess around and watch tutorials to get used to java

During

  • Using limited knowledge, I used simple terms to get the job done efficiently and with the least amount of confusion
  • Use varying aspects of Code.Org and try to implement interesting ways to change up my clash quiz
  • Added a timer like the real game where you have to finish the quiz before the timer ends or you choose the wrong option

Reflection

Main Ideas Purpose Implementation
Program Purpose For the user to enjoy my fun and easy quiz The quiz is heavily relied on user interaction and how their choices affect them
Data Abstraction Count points (crowns) for player and timer Resemblance of game
Complexity Objective is to keep it simple Just mainly code reliant on buttons and repeated code to keep it simple and reduce complex load
Procedural Abstraction Once you finish the match, you are taken to a reward screen Reward screen reveals a new card that you can use in game
Algorithm Implementation Using a timer The timer goes through a loop function to count down from 3 minuites when "Battle!" is clicked
Testing Make sure quiz is fully functional Run through all variables and options within the quiz to verify everything is operational and ready to go!
  • The link to my quiz!

Clash Royale App Lab Quiz

  • Code is below
var startTime;
var isRunning = false;
onEvent ("startquiz", "click", function() {
  if (!isRunning) {
    isRunning = true;
    startTime = getTime();
    
    timedLoop(1000, function() {
      var currentTime = getTime();
      var elapsedTime = currentTime - startTime;
      elapsedTime = Math.round(elapsedTime/1000);
      setText("timer", "Time: " - elapsedTime + 180);
    });
    
  }
  
});
onEvent("returnhomeend", "click", function() {
  isRunning = false;
  stopTimedLoop();
});

var crowns;
onEvent("startquiz", "click", function( ) {
  crowns = 0;
  setScreen("giantquestion");
});
onEvent("radio_buttonG!", "click", function( ) {
  showElement("nextS");
});
onEvent("radio_buttonG2", "click", function( ) {
  setScreen("theend");
});
onEvent("returnhomeend", "click", function( ) {
  setScreen("homescreen");
});
onEvent("claimreward1", "click", function( ) {
  setScreen("noreward");
});
onEvent("returnhome", "click", function( ) {
  setScreen("homescreen");
});
onEvent("nextS", "click", function( ) {
  setScreen("successgiantattack");
  hideElement("nextS");
  showElement("nextskarmy");
});
onEvent("nextskarmy", "click", function( ) {
  setScreen("skarmyquestion");
  hideElement("nextskarmy");
});
onEvent("radio_buttonS1", "click", function( ) {
  setScreen("theend");
});
onEvent("radio_buttonS2", "click", function( ) {
  showElement("NextAttack");
});
onEvent("returnhomeend", "click", function( ) {
  setScreen("homescreen");
});
onEvent("NextAttack", "click", function( ) {
  setScreen("attackquestion");
});
onEvent("Left", "click", function( ) {
  setScreen("attackleft");
});
onEvent("RIGHT", "click", function( ) {
  setScreen("attackright");
});
onEvent("attackgiantleft", "click", function( ) {
  setScreen("attackleftgiant");
});
onEvent("attackgoblinleft", "click", function( ) {
  setScreen("attackleftgoblin");
});
onEvent("attackmusketeerleft", "click", function( ) {
  setScreen("attackleftmusketeer");
});
onEvent("attackskarmyleft", "click", function( ) {
  setScreen("attackleftskarmy");
});
onEvent("attacksparkyleft", "click", function( ) {
  setScreen("attackleftsparky");
});
onEvent("giantright", "click", function( ) {
  setScreen("attackrightgiant");
});
onEvent("wizardright", "click", function( ) {
  setScreen("attackrightwizard");
});
onEvent("musketeerright", "click", function( ) {
  setScreen("attackrightmusketeer");
});
onEvent("righthogrider", "click", function( ) {
  setScreen("attackrighthogrider");
});
onEvent("goblinright", "click", function( ) {
  setScreen("attackrightgoblin");
});
onEvent("nextleftgiant", "click", function( ) {
  setScreen("attacksucessboth");
  crowns = 3;
});
onEvent("nextleftgoblin", "click", function( ) {
  setScreen("attackleftdefeat");
  crowns = 0;
});
onEvent("nextleftmusketeer", "click", function( ) {
  setScreen("attackleftdefeat");
  crowns = 0;
});
onEvent("nextleftskarmy", "click", function( ) {
  setScreen("attackleftsuccess");
  crowns = 1;
});
onEvent("nextleftsparky", "click", function( ) {
  setScreen("attacksucessboth");
  crowns = 3;
});
onEvent("attackrightgiant", "click", function( ) {
  setScreen("attacksucessboth");
  crowns = 3;
});
onEvent("attackrightgoblin", "click", function( ) {
  setScreen("attackrightdefeat");
  crowns = 0;
});
onEvent("attackrighthogrider", "click", function( ) {
  setScreen("attackrightsuccess");
  crowns = 1;
});
onEvent("attackrightmusketeer", "click", function( ) {
  setScreen("attackrightdefeat");
  crowns = 0;
});
onEvent("attackrightwizard", "click", function( ) {
  setScreen("attackrightsuccess");
  crowns = 1;
});
onEvent("returnhomeleft", "click", function( ) {
  setScreen("homescreen");
});
onEvent("returnhomeright", "click", function( ) {
  setScreen("homescreen");
});
onEvent("nextleftgiant", "click", function( ) {
  setScreen("homescreen");
});
onEvent("nextwinscreen", "click", function( ) {
  setScreen("winscreen");
});
onEvent("nextwinscreenright", "click", function( ) {
  setScreen("winscreen");
});
onEvent("nextwinscreenleft", "click", function( ) {
  setScreen("winscreen");
});
onEvent("nextwinscreen", "click", function( ) {
  setText("crownlabel", crowns + "crowns");
});
onEvent("nextwinscreenright", "click", function( ) {
  setText("crownlabel", crowns + "crowns");
});
onEvent("nextwinscreenleft", "click", function( ) {
  setText("crownlabel", crowns + "crowns");
});
onEvent("returnhomewin", "click", function( ) {
  setScreen("fakehome");
});
onEvent("claimrealreward", "click", function( ) {
  setScreen("golem");
});