Sign in to follow this  

First Ever Game Created - Tetris

Recommended Posts

Hello GameDev community!

I took a programming class on Java a couple of semesters ago, and decided to expand my computer programming skills by learning to create games. I purchased Killer Game Programming in Java and created this tetris clone after reading the first few chapters. The reason I am posting this to the forum is to receive feedback on my implementation. The basic game loop is pretty much taken verbatim from the book.

The way I decided to implement this was to create a 2d screen array. Each entry in the array corresponds to a block on the screen (with 0 being white or empty). I then created a class for each individual piece. The pieces are represented by four coordinates, corresponding to the relative locations of the four boxes (for example a line piece was (-2,0) (-1,0) (0,0) (1,0) ) , and a coordinate that corresponds to the position of the (0,0) box in the array. The pieces are then drawn relative to this (0,0) position.

My goals for this game were to create the game without looking at specific online tetris tutorials (to force myself to learn to think like a game programmer) and use good object oriented as well as game programming style.

My biggest annoyance with the way I implemented the game were that I couldn't figure out a clever transformation on the pieces to rotate them, I instead ended up hard coding all the different rotation states.

I was hoping that some of you with game development experience could comment on whether the way I implemented this game is a logical way to do it (it works, but for all I know there could be a way simpler way to do this) and to take a brief look at my code and suggest ways I could have better used object oriented style and game programming techniques.

Thanks for reading and I appreciate any feedback that is offered!


Share this post

Link to post
Share on other sites
I haven't looked at it yet, but up front, the only thing matters is that you made that game. And you made it [i]on your own[/i]. You are already ahead of the most newbies, because that's the way to learn problem solving.

Your next game will be much better coded.

Congratulations, programmer!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this