Finally made a game!!

sjn78

Junior Contributor
Joined
May 4, 2003
Messages
255
Location
Australia
This is my first go at a game. Its a Tetris game (yet another one made).

Still have a couple of little bugs in it. I have attached it for anyone to look at or comment on.

The code isn't commented, so good luck in navigating through it. A few parts of code in there are probably a bit long winded, but for a first go at making a game, I'm reasonably happy with it.

Feel free to say what you like about it, as I will definitley learn more from your comments and suggestions.

Oh yeah, it's in VB.

Steve
 

Attachments

Nice work! The controls for moving the blocks is as I expected
them to be. Now, for a few suggestions:

It helps if all pieces of the same type are the same color. It's much
easier to notice patterns and it helps trigger recognition of the
piece when it first shows up. Try to match the original Tetris
colors, if you can. :)

You could add so much more to the game if you drew out the
shapes instead of using Panel controls. Not only do they provide
some overhead for creating and using, but they aren't really that
pretty to look at. You have all the code down for positioning the
squares and such, so it should be easy to adapt to drawing
shaded rectangles or images to make the game look nicer. There's
also a little flickering when the panels move, which would be
eliminated if the drawing was done correctly.

There are some repetitive code sections that could be greatly
reduced in size, such as lines 757 - 839. You could shorten that
by using some math:

Visual Basic:
For i = 0 To 179
  If found(i) = True Then
    count += 1
    If count = 10 Then
      lines(17 - (i \ 10)) = True 
      count = 0
    End If
  Else
    level -= 25
    count = 0
    i = (i \ 10) * 10 + 9
  End If
Next i

Now that's a lot shorter, eh? The first replacement integer divides
i by 10 to get a whole number, then subtracts that from 17
because that's the highest index in the lines array. The second
part rounds i down to the nearest multiple of ten, then adds 9.
Compare it to your code, and the pattern will make sense.

Keep up the good work.
 
Thanks for the comments. I know there will be a lot of code that could be more efficient and just need to look over it to find better methods.

I am playing around with another game now, using GDI to do the graphics. Once I figure it all out, I will go back and change the graphics on the Tetris game.
 
Back
Top