OTFirstClass

Tetris Game in 36 lines of code - Help Needed

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

Share this post


Link to post
Share on other sites

:) If it was a normal coded game, you were going to add the reset functionality as a breeze. ;)

 

Also I want to share a good tutorial how a to make a Tetris Game in ActionScript but hey JavaScript is not so away 

so it's a good info: http://www.emanueleferonato.com/2011/05/02/creation-of-a-complete-flash-tetris-game/

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.