tetris concept question
I am building my first game in directx and it is of course a tetris clone. So far I have the basic animation of the blocks down. I have it using an array of 4x4 and puts a block in each piece. I can move it around the screen and am working on the collision detection as we speak.
I will post my collision detection once I get it working as it is my first time doing it and see what you all think of it.
My question is once the block hits the bottom and the new one appears how do I handle the old block? I assume you some how add it to a array and when the array is full on one line you delete that entire line of the array. Not really sure on the idea of it. Was wondering what is the standard logic behind the idea of handling the blocks once they hit old blocks or the bottom
The approach of building the program I am taking is the following.
Basic Window Creation - FINISHED
Keyboard input for moving a block - FINISHED
Array to build different shapes - FINISHED
Collision Detection
-Basic Play area created - Current Stage
-Side to Side collision
-Bottom collision
Generation of new block on bottom collision
Handling of old blocks
Handling of blocks as full line created
Rotation(Not actual rotation of sprite) for turning of blocks
That is the basic progress I want to follow as I create the game.
This is my first game and time using directx. So far the learning curve has been decent but I have done database programming and have just finished my second class in C++.
Plexis
Off the top of my head here, but...
I''d create a 2D array to represent the playing field. When a block is dropped, it gets added to this array. While a block is still active (moveable by user), I would check the block''s current position based against the array and if there is any overlap with existing blocks, prevent the movement.
When the user fills an entire line (easy to check, just scan the array for completely filled lines whenever a block is dropped), shift the array X lines downwards while clearing the top lines. You could do additional post-processing if you want effects like blocks dropping downwards to fill holes, etc.
A long time ago I was diddling with a Tetris clone and I believe that''s how I did it.
---
http://www.gapingwolf.com
I''d create a 2D array to represent the playing field. When a block is dropped, it gets added to this array. While a block is still active (moveable by user), I would check the block''s current position based against the array and if there is any overlap with existing blocks, prevent the movement.
When the user fills an entire line (easy to check, just scan the array for completely filled lines whenever a block is dropped), shift the array X lines downwards while clearing the top lines. You could do additional post-processing if you want effects like blocks dropping downwards to fill holes, etc.
A long time ago I was diddling with a Tetris clone and I believe that''s how I did it.
---
http://www.gapingwolf.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement