Reaction game
Create a reaction game
- Step 1: Use a timing function with a delay of 750ms to repeatedly generate a random number (1, 2 or 3) and add the
red
class to the corresponding block
(NOTE/TIP: the generated number/corresponding block must differ from the previous number/block, so generate a new random number until it differs from the previous one) - Step 2: Add a click event to all 3 blocks. If clicked when the block is red:
- The block temporarily* gets a green background color (TIP: class
green
) - Your score is increased by 1 point, and this score is temporarily* shown in the clicked block
* Make sure that the green background color and score is removed when a new red block is selected (Step 1)
- The block temporarily* gets a green background color (TIP: class
- Step 3: The game stops when you scored 5 points