I'm coding Tetris. The code below is unfinished and still very rough around the edges with lots of improvements to be made. Here is what I've done so far.
Added all block types and their rotations
Block fall and can be moved/rotated (Use blockOp.left() blockOp.right() blockOp.rotate() blockOp.down() )
Wall and floor collision detection
All blocks are the same colour but want to add full RGB later
The next part I'm working on is storing the fallen blocks in an Array so I can render them on each frame and then detect when other falling blocks need to settle on top of them.
Here is a link to see the full code. The output is a 16x8 RGB-123 LED Matrix (the code should run fine without connecting anything) Line 191 logs the stored fallen blocks array when I then want to loop for rendering and collision detection but it's is very slow. http://jsfiddle.net/t0ucb1yt/1/
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm coding Tetris. The code below is unfinished and still very rough around the edges with lots of improvements to be made. Here is what I've done so far.
The next part I'm working on is storing the fallen blocks in an Array so I can render them on each frame and then detect when other falling blocks need to settle on top of them.
Here is a link to see the full code. The output is a 16x8 RGB-123 LED Matrix (the code should run fine without connecting anything) Line 191 logs the stored fallen blocks array when I then want to loop for rendering and collision detection but it's is very slow.
http://jsfiddle.net/t0ucb1yt/1/