|
-
March 4th, 2010, 02:39 AM
#1
saving tetris blocks
Hello,
I'm currently developing a tetris clone and I have a problem saving the blocks.
I want to save the blocks in a two-dimensional array that represent the game grid (10x20). I simply want to change the values of the array (to the specefic shape type eg, 1,2,3,4... 0 if there is no block) if there is a block in that specific coordinate.
I'm currently creating blocks like this:
Code:
/*
* 00000
* 01200
* 00110
* 00000
*/
g.FillRectangle(System.Drawing.Brushes.Red, startx - width, starty, height, width);
g.DrawRectangle(System.Drawing.Pens.Black, startx - width, starty, height, width);
g.FillRectangle(System.Drawing.Brushes.Red, startx, starty, height, width);
g.DrawRectangle(System.Drawing.Pens.Black, startx, starty, height, width);
g.FillRectangle(System.Drawing.Brushes.Red, startx, starty + height, height, width);
g.DrawRectangle(System.Drawing.Pens.Black, startx, starty + height, height, width);
g.FillRectangle(System.Drawing.Brushes.Red, startx + width, starty + height, height, width);
g.DrawRectangle(System.Drawing.Pens.Black, startx + width, starty + height, height, width);
this is for the z block. the 2 is the center of the brick (the starting point / startx,starty). I'm think that I should save the block in an array as shown in the comment above. 2 is for the center brick which is the coordinates i need to build it from. 1 is another block and 0 is no blocks. But I don't know how to save this array in my current game grid array.
Anyone know how to do this?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|