“Using functions can help you organize events and avoid having to duplicate groups of actions or events.” Reusable logic –Are you repeating the same events->actions? –Ex. Multiple ways to lose For you programmers out there… –Has parameters and return values –Can do nesting and recursion
Want a home screen? An about Page? Want extra levels? –Add a new layout Basic Idea –4 layouts Home, game, end, and about 2 options with Event Sheets –Add a new one –Reuse an existing one
Additional Layouts (cont.) Home –Button to Game and About Game –Lose game and go to End End –Button to Home or Game (restart) About –Button to Home and links to website, feedback, social media, etc.
WebStorage Object –“The WebStorage object can store data locally on the user's computer between sessions.” –“The WebStorage object allows data to be stored in two places: Local storage and Session storage” Local storage is permanent (until the user clears their cache). If the user comes back the next day, local storage still has the saved data Session storage only lasts with the current browser session. If the user comes back the next day, session storage is empty again
Permanent Storage (cont.) Usage –High scores, achievements, current level, etc. How does it work? –Key/value pairs similar to dictionary Basic Idea –Check to see if a given key exists –If not… create it –If so…use it