Tetris Clone
A couple years back I programmed my first game, which was a clone of Tetris in C++. There are many good reasons to remake a classic game. First, you do not need to worry too much about a design document, since the classic games tend to be pretty simple. Second, you can learn a lot doing it yourself.
The actual game code took about a week to write. I actually spent more time writing my DirectX 7 graphics engine, which took about two weeks. Too bad I never used this graphics engine I made to write any other games. Oh well, I have since moved on to easier and more powerful graphics interfaces.
Today, I decided to get some more experience with Flash, so I ported my Tetris clone to Flash ActionScript 3. It took most of the day, but I think the results are pretty decent.
Here is the embedded Flash version of the game.
Keys:
Left/Right/Down Arrow Keys – move your block around
Z or Spacebar – Rotate Left
X or Up Arrow – Rotate Right
Spacebar – Restart the game after you lose
J/K/L/I – Alternate Arrow Keys
Notes
- All the blocks have 4 orientations, instead of most other tetris games that have 2 for most of the blocks. (Watch what happens when you spin the I peice.)
- Both versions have a very minimalistic, just the single window with a single line for score info.
- No score keeping. I suppose you can just take screen caps if you wanted to preserve your high score. XD
- I was having problems with the Arrow Keys in the browser, so I added an alternate set of keys to both versions.
- No lock delay is programmed which makes the game quite hard when it gets close to the top.
- No hard drop.
- The Flash port does not seem to be as responsive as the C++ game.
- The Flash port is a heck of a lot smaller, 4 KB vs 147 KB. Then again, how big is Flash and DirectX?
- C++ pauses when the window is out of focus. Flash port currently has no way to pause the game.
- The randomizers aren’t fixed, so it’s possible to see the same piece more often then you would in more official versions of the game.
Download: Here
I’ll probably see about posting my source code eventually. I’m not very happy with it, since I the code has a lot of my old coding practices. (Update: Source code for the Flash version can be found here.)
Maybe I should get around to rewriting some other classics. Or better yet, just write more original games.