This is a game of Tetris I programmed in XNA Game Studio from scratch! No books, no websites, all coded by me after researching the algorithm behind Tetris. XNA is a framework for Visual Studio C# which allows you to make 2D and 3D games for the Xbox 360 and PC. The software is 100%, and if your interested in XNA you can visit the official website (Only thing that cost money is if you want to debug your games on Xbox 360, PC games are 100% free to make and the software requires no subscription):
http://creators.xna.com/
SOUND - the game has a theme song and full blown sound effects, my desktop recording software is not capable of recording the sound though. Wait for me to upload the files and then you can experience the game and sounds for yourself!
This game took me a couple of weeks to make, as it's my first real animated game I've ever programmed from scratch ( come from a web programming and software programming background). I've been wanting to make a game of Tetris for a couple of years now, since I started using Qbasic a couple of years ago in school.
At first I wanted to make a game in VB.net, but if you didn't know, Visual Basic sucks at games! I was anxious to use XNA but intimidated by it. After learning Java in college, though, I realized C# is an exact knock off of the Java language and I easily figured out the XNA framework to make my own game.
There are some minor flaws and bugs in the game such as the rows clearing and shapes not rotating when on the edge of the grid, and the coding is a nightmare, as I could have made better use of OOP when I made this but I was more interested in just getting the game to work! Later on I will add the code though, if anyone wishes to see how it works.
The way a traditional modern game of tetris is coded by today uses the "Flood Fill Algorithm", where all the blocks are drawn on the screen and then blocks are flip-flopped as they drop and rotate on the screen. Another array holds the life of each block, if a block is currently alive in that place.
http://en.wikipedia.org/wiki/Flood_fill
Another method I've seen is with smooth animation and no use of the flood fill, although this would require hundreds of lines of code and mathematical calculations to determine the coordinates of each block depending on where others is.
I'm happy to help anyone who is working on their own game of Tetris, it's not that difficult to accomplish although it requires some deep thinking and planning of with pen and paper! Good luck!
can u pls send me send me a link to the code as well!!
tsola2002 2 years ago
Sure, send me your email address in a message and I'll send you the source code.
sedativechunk 2 years ago
i would like to see the code for this game do you know when your going to post it we have do create a game for class and i want to do tetris and your game is the only game i have seen using xna 3.0 and c #
stephie3232 2 years ago
I'll send you a link now with the source code. Check your inbox.
sedativechunk 2 years ago