Goal: Start by following along with the example from Exploring Asynchrony with setInterval and setTimeout. Then choose one of the following projects to build. Build out the game logic, including using async callbacks with
setTimeout(). Add testing with Jasmine and Karma. Make sure that you continue to use webpack and keep your business logic separate from the user interface logic.
Begin by building out the logic from the game in this weekend’s lessons. Add levels, difficulty settings and different items. In addition to the bear’s food level, consider adding other levels such as a mood level, sleep level, etc.
Next, spend the rest of the day tackling one of the following options. If you complete one with time to spare, select another:
You may have had the chance to make a Tamagotchi application in your Level 2 class. If you didn’t, or if you did but you’d like another opportunity to create an application that can deal with the passage of time and asynchronicity, here’s your chance.
The Tamagotchi was one of the most popular toys of the late ‘90’s and early ‘00’s. It was a handheld, digital pet that could be carried around on a keychain-sized mini computer. Tamagotchis required loving care by pressing buttons to feed them, play with them, and put them to sleep. If you didn't give a Tamagotchi enough food, attention or rest, it would die.
Create an application using
setInterval() to adjust a Tamagotchi’s food, play and sleep levels (as well as any other levels you’d like to add). Then create items and actions that can increase or decrease these levels. If you’re able to build out an application fully for one Tamagotchi, refactor so that a player can have multiple Tamagotchis.
If the Tamagotchi theme doesn’t resonate with you, apply a similar theme to an Animal Farm application. We don’t mean George Orwell’s Animal Farm (though you can go that direction if you like); instead, create an application where users have to feed and care for their animals.
Pandemic is a cooperative board game where players have to stop a deadly disease outbreak before it wipes out the planet. Build out your own timed version of Pandemic, taking as much or little inspiration from the game as you like.
setTimeout()to make the disease spread exponentially after a certain period of time).
Create a timed flash card application that utilizes
You can also choose another game as inspiration (such as Civilization) or come up with another project that utilizes
setInterval(). Consider other ways you can utilize asynchrony in your code. Take the time to practice the concepts you learned over the weekend.