Moron Test Final / Version 6 Beta

(Assignment here)

Moron Test Version 6 Beta

Blog Questions

  • The scenes that I worked on were based on scene 9, scene 18, and scene 23.
  • The first addition I made in my V6 Beta was to add a fail function.
function fail() {     
clearIcons()     
clearInstr()     
instrSpace.innerHTML = ` <h2 class="fail" >You failed! Click the face to restart.</h2>`     
iconSpace.innerHTML = ` <i class="fas fa-tired" style="     
color: #911c17;     
left: 50%;     
top: 50%;"></i> `     
icons = document.querySelectorAll("i")     Array.prototype.forEach.call(icons,         
function (icon, i) {             
icon.addEventListener("click", function () {                 
level = 0                 
start()             
})         
}) 
}

This function clears the icons and instructions, displays a failure message, along with a sad face that allows the user to restart the game when clicked.

  • The next addition I made was to add a win function.
function win() {     
clearIcons()     
clearInstr()     
instrSpace.innerHTML = <h2 class="win" style="     
top: 60%;     
font-size: 20 rem;">Congratulations</h2>     
<h2 class="notamoron">You're not a moron!</h2>     iconSpace.innerHTML = <i class="text-icon" style="     
color: #911c17;     
left: 50%;     
top: 50%;     
font-size: 10rem;     
">Restart</i>     
icons = document.querySelectorAll("i")     Array.prototype.forEach.call(icons,         
function (icon, i) {             
icon.addEventListener("click", function () {                 
level = 0                 
start()             
})         
}) 
}

This function clears the icons and instructions as well, but displays a success message, along with the word “Restart” that allows the user to restart the game when clicked.

  • The final addition I made was to change the start function to make the win function appear when the user had completed all of the available levels.
function start() {     
if (level < scene.length) {         
clickCount = 0         
clearIcons()         
mapIcons(level)         
iconListener()         
clearInstr()         
mapInstr(level)     
} else {         
win()     
} 
} 

Leave a Reply

Your email address will not be published. Required fields are marked *