8000 GitHub - oscargt/tetris: Tetris — Javascript + HTML5
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

oscargt/tetris

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris

Tetris — Javascript + HTML5

Here's a stand-alone library that plunks a Tetris game into some DOM, because nobody has ever written code for that before, ever.

The program's only requirements are jQuery and Underscore.js, which you probably already have loaded on your site. HTML5 is also a requirement; Tetris draws on a <canvas> element.

tetris.js exposes a single Tetris constructor function to the global environment:

Tetris($element), where $element is the jQuery object that the Tetris DOM gets injected into. That's it!

<script type="text/javascript" src="tetris.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        new Tetris($('div#tetris-game'));
    });
</script>

The Tetris script .appends elements with id's "tetris", "tetris-canvas", "tetris-right", "score", "lines", "tetris-next-piece", and "start", so you probably shouldn't id any of your own elements with those names. I probably should've done a better job namespacing this thing, but never mind. There's also a CSS class "next-tetromino".

About

Tetris — Javascript + HTML5

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0