Domgame — Moron Test scene-specific function and helper functions

Once again no link in this because all of the versions are in one.

Describe how the scene[level].main(icon, indx) function is called within the check(icon, indx) function. How are we tracking the icon and index values? Why do we need to track and pass the icon and index values to the scene’s main function? What does the scene’s main function do with these values?

The main function is under the scene and this is to take values for the icon and the index from the game when its clicked. Under the function, check(icon, indx) you add scene[level].main(icon, indx) so that the values are passed at the right scene and this is after the (‘click’). If the index equals the answer the count increases and then the main functions run. We take the arguments from the outside and pass them from the inside of the function.

main: function(icon, indx){
            console.log(`you clicked ${icon}, the answer is ${scene[level].answer[clickCount-1]}`)
            // (this)  pertains to the specific icon

This is to hide icons and you can then add this under the main function.

function hide(el){

Leave a comment

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