I am trying to make my own version of the Tetris game. So far, I am able to show pieces, rotate them. But I am stuck at a point and not sure how to proceed.
I have a
BoardClass
with static integer arrayboard
for the grid. With different integer numbers I am showing different colors.Block
class which has methods to generate random blocks and rotate them.- A
Graphic
class which display colors based on theboard
array, and - A
GameLogic
class for starting, pausing game.
For current piece I have taken a 4x4 array and is placed onto the board in first four rows of board
All works good. But how do I start moving things. How to establish a relation between blocks is where I am stuck.
My problems
- Am I working on right track?
- How to automate things, I mean, how will the blocks appear automatically one after another. I know I can have a DispatcherTimer and move block at tick event but drawing and redrawing the complete grid is slow. I want only the portion of the game grid to be redrawn.
- If I move my piece left/right/down the complete piece array would move and this would mean a 4x4 piece moving and not just the piece which may be in 1x3 or 2x2.
- How to know if the piece is new or an old settled piece. I know I can take a boolean value but I think a boolean array of 10x20 would be large.
I know these might not be good question to ask on SO but am stuck and any help would be appreciated. And ask me if you want to see any piece of code.