-1
\$\begingroup\$

I have a JS game similar to snake how can i set a timer for the game where when the game ends it displays game over, shows the score of the player, and has a play again button?

\$\endgroup\$
1
  • \$\begingroup\$ This is kind of on a sharp edge between game development and general coding which would be rather placed on stackoverflow.. \$\endgroup\$
    – derHugo
    Jul 20 '17 at 17:17
0
\$\begingroup\$

Use setTimeout

setTimeout(function(){code here},seconds*1000)

The code will run after X seconds.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.