We’re coming to the end of the Moron Test, having built the logic and a number of tools to interact with scenes. There are just a few remaining tools needed to create all the various interactions in the game. I’ve created a complete
scenes.js file you can use to follow along, not having to write new scenes if you’d like to use it. It also includes another js file
a4.js which is called to build a whole bunch of icons as well.
For the new tools, we’ll need to have a timing function and will use the
setTimeout(callback, time) function. Also, we need to manage events that happen before a user might start clicking on icons and after a user has clicked on all the correct icons. To do this we will add a
finish keys to each scene with a default
null value. But we will be able to add functions where necessary.
And, finally we’ll create a
failScene function for when our user makes a mistake.
- All Scenes and unhide helper function – Moron Test Project in JS
- Timer Function and start scene function – Moron Test Project in JS
- Timer Function and finish scene function – Moron Test Project in JS
- Fail Icons and FailScene Function – Moron Test Project in JS
For the Blog:
Describe how the start and finish functions are called in moron.js. How does the program know if there is a start or finish function to run? Where is each start or finish function placed and why?