Jump to content
  • Advertisement
Sign in to follow this  

First Ever Game Created - Tetris

This topic is 2233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 on your own. 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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!