Saturday, July 31, 2010

Katesplayground Early Years

And if you develop a Tetris with Javascript ...

Una idea mi girava per la testa.
Perche' non provare a sviluppare una versione del Tetris con HTML e Javascript ...

Ero un po' scettico pero', dicevo: ... ci vorra' molto tempo ... magari non ci riesco ... e' difficile ...

Poi ci ho pensato seriamente.
Ho cominciato giocando con le parti grafiche, ho disegnato il tavolo di gioco, ho disegnato i pezzi ... e poi son passato alle prime prove con il javascript.

Piccola premessa: For some 'of months now for work, I practiced with the MooTools framework , and' very easy to use and its core there are already 'functions useful for animations.

So, I said, I began to develop the rotations of the pieces using mootools ( the end I could not even use it, or use jQuery ... or whatever ... ), each piece, talking about html, and ' made by a div that contains 4 other div. Playing with the margins and absolute positioning I found all the details of the rotations.

Ok, I had everything. Graphically. And now there was the most 'difficult. How to put the pieces into the game table? Well ... I used a large array. I filled the table with their beautiful boxettini Cartesian coordinates ... et-Volia '... I found a way to continue development.

overcome the obstacle collision with the wall and with the pieces already 'inserted (as very painstaking work, I can not bore you with details) I have integrated levels, calculating the score, pause, SoftDrop the hardDrop. .. and behold, in about a week I got my tetris (s' was very helpful this wiki about the various details to be implemented).

I baptized TetriJs :)

So, you want to play and / or download the source code? I hope so:)

Here find all the code I released under the GNU GPL , so 'everyone can' redistribute it, modify it, smashing more like 'he likes (within the terms of the license, of course):)

E' likely fixando updated as bugs, adding features' and more.

Meanwhile, what do you think? You like it?

Update (August 21, 2010): I have released a second version. I also fixed some bugs and added new features'. The complete changelog and ' here. Thanks for your comments and suggestions. I hope you can work more on ... I miss a few things to add:)

PS: I know that works fine on IE7 ... But I do not know 'if I have' desire to fixarlo for him ...

0 comments:

Post a Comment