How does Tetris work?

Blitz3D Forums/Blitz3D Beginners Area/How does Tetris work?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I remember there being a couple of quirks.

Firstly, since I was rotating the shapes myself instead of storing pre-rotated versions (I was building 3d meshes and RotateEntity()ing,) there were a few differences between my rotations and the original game's which I had to code for.

Secondly, there are many different ways to handle rotation attempts when there isn't room to rotate (i.e. when the rotated shape would intersect with the mess of blocks in the well.) Some games (like the original) simply don't allow rotation that would move through other blocks. Other games (like the awful GameCube version) move the active shape up until it doesn't intersect, allowing players to "bounce" a shape indefinitely on the well even at the highest game speeds. Still others (like the wonderful New Tetris for N64) have special rules for rotations to allow you to pull off some pretty cool moves. For example:

|###         |       |#           |
|#%%%%%%%%%%%|  -->  |#%%%%%%%%%%%|
|  %%%%%%%%%%|       |##%%%%%%%%%%|
|%%%%%%%% %%%|       |%%%%%%%% %%%|


I recall that last one being tricky, because the shape has to both move and rotate it to work. I believe I had to do two checks to see if rotation would work: one with the shape's y-position incremented by one.

Of course, the original Tetris didn't support this, so it's not a requirement that you have to. :)

P.S. vinylpusher: [codebox]