I wanted to see how simply/fast I could make a clone of Tetris, so here it is! I did this in about 5 hours, and it's probably my 3rd time writing it. Just wanted to share it since it may help others that are trying to do something similar.
https://github.com/kmiron/SFMLTetrisSome things:
- I spent very little time on the graphics, and there's no audio (just wanted to focus on the gameplay
- I think the collision code worked out pretty well this time, but I'm always looking for more suggestions on how to improve it
- Rotation tries to rotate the piece, if it fails it moves the piece one slot left, and then one slot right (according to TGM rules)
- Control will swap your piece into the holding pen if you haven't already
- You can press ALT to push garbage pieces into the play field (sucks if you try to alt tab though)
- There is a ghost piece that shows where you will drop if you press space
NOTE:
I also started the work of adding client/server support (ultimately I would like to support 16 players at once), but all it does right now is let you specify whether you want to start as a server (--server on the command line) or a client (specify an IP address) and then the server can press 'B' to say hello to the client in their console.