Jump to content

Tetris Game in 36 lines of code - Help Needed


OTFirstClass
 Share

Recommended Posts

I recently saw this post on Twitter about this tetris game in javascript in 36 lines of code.

I want to use this code but am having problems picking it apart.  It is working just fine, but I cannot figure out how to restart the game and go back to the default values after a game ends.

The code is at http://jsfiddle.net/ova777/kFxja/

 

What I have done very simply is to wrap the code in a function startApp() and added a button in the html code that will start the game when clicked.

 

What I want to do is after the game finishes, reset things and restart the game.  I do not want to do this via a refresh, but rather set things back to the default.

 

Any help would be greatly appreciated.

 

I have attached my source as well (I have added some CSS styling of my own)

Tetris.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...