function birdFired() { // user pressed the space bar, which changes birdFired to true if ( !isSplash ) { // we're on the game - move the bird } }
In the next conditional, we test if there are any obstacles in our way. If so, we pause the game and prompt the user for help. The player then has 3 seconds to respond with a command to move the bird around. If no obstacles are found, we proceed to check if it's day or night.
If there are no obstacles in our way, we proceed to check if it's day or night.
var isDay = false; var isNight = false; function birdCheck() { // test to see if it's day or not var today = new Date(); todayDate = today.getDate(); if ( todayDate == null ) { // it's not morning yet! isDay = true; }