Results 1 to 24 of 24

Thread: Tetris

Threaded View

  1. #1

    Thread Starter
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Resolved Tetris

    I've decided to post my first major XNA work for review, criticism, etc: Tetris.

    This game was originally programmed in VB.NET 2008 and XNA 3.1. I made all the graphics myself and all the sounds effects are public domain. The current version uploaded uses VB.NET 2010, .NET4 and XNA 4.0.

    In order for you to get the sound to work, you'll need to download bass.dll here. It's the link at the VERY TOP of the page that says: "Platform: Win32, OSX" with two very tiny "Download" links. The Bass.NET library found further down the page is not used. The bass.dll file must simply be in your output directory.

    If you drop OGG or MP3 files in the "Music" directory created in the output directory, it'll random shuffle them and play them as you play the game. Once again, you need the bass.dll library to make this work.

    I chose to use the Bass.dll library over the native XNA methods for it's native support of MP3s (thus making file sizes much smaller), it's easy on-demand firing of sound FX and it's simplicity. Compared to the ugly behemoth XNA gave me which requires conversions of audio files with the XACT tool and only allowing storage of those audio files as bulky WAV files, it was a no-brainer.

    The game is completely keyboard driven:
    F1 = New Game
    Esc = Quit Program
    Left - Right Arrow Keys = Move Piece
    Down Arrow = Drop Piece
    Up Arrow = Rotate Piece

    I tried to keep the game action as faithful to the arcade original as I could, thus, there's extensive coding in just mapping how the controls work with things like grace periods before a piece is considered "stacked" and auto-repeat for holding left and right. I really was impressed by how much time I had to spend tweaking the controls; it was something I totally didn't expect. Leaving the controls as simple keypresses made for lackluster game play on the early levels and immense frustration at the higher levels when pieces would unforgivingly stack as soon as they made contact. It was certainly a learning experience.

    I'm not entirely happy with the actual code I used; it's probably some of my sloppiest work, but I was trying to go for functionality over form with this project. Plus, I upgraded the project several times without rewrite and it shows.

    Anyways, download it, compile it, tell me what you think. Tear it apart and show me how I could have written it better or study it to learn how to make your own VB.NET/XNA games. I appreciate all comments.

    Project files only (no binary code, needs XNA installed and bass.dll): Tetris.zip

    UPDATE: Full solution package with binaries, bass.dll, XNA runtime installer and setup project..

    UPDATE: Here is an updated version that has been modified to work in Visual Studio 2010 under .NET 4 and XNA 4.0. This contains project files only. You'll need bass.dll to make it work: Tetris_NET4_XNA4.zip

    Name:  Tetris.png
Views: 10736
Size:  300.4 KB

    Name:  Tetris2.png
Views: 8819
Size:  332.0 KB
    Last edited by Jenner; Sep 14th, 2011 at 05:32 PM. Reason: [VB.NET 2008][XNA 3.0]
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width