• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Tetris collision again.

## Recommended Posts

Joppe    122
I asked awhile ago about tetris collision and the best way to do it. I decided to go with the array-technic. But now I am a little stuck. I really never got started. Where should I begin? How should the routines for collision look like? All help are greatfully appreciated.

##### Share on other sites
Guest Anonymous Poster
why would you need a collision system for a tetris game?

the pieces are set sizes and they move set distances.ie one grid square at a time..

for the basic tetris game you have a 2d grid of squares..the majority of the game is figuring our when to stop a piece from moving..you wouldnt use a "true collision" routine for this, youd just need to check the shape the the piece moving with the slots in your array. .

##### Share on other sites
Joppe    122
I just need to know how a keep track of the pieces.

When do I change the 0:s to 1:s etc.

##### Share on other sites
chris1234    122
heya,

I''m working on a tetris game too...and there''s only two moments when you copy your shape to the pit (change the matrix'' 0 to 1''s)
1: when the shape hit''s the bottom of the pit...just check if the lowest part of your shape is in the highest or lowest row of your matrix (depends on if the bottom of your pit is row 0 of the matrix or if the bottom of the pit is the highest row of your matrix.
2: your shape stops moving when the shape falls ontop of another shape.
hope that helps a bit....

Chris

##### Share on other sites
setzor21    122
hiya,

I see you guys are working on a tetris game. I was working on a tetris game that was going to be really super uber duper and crap. But as all things, I changed my mind, a playable demo is at

http://www.geocities.com/khaotix/nb11.zip

updated exe is nb111b.zip

anyhow, it works fairly well, and could use some optimization, it uses d3d8 and it''s 3d. main falling block rotates and crap. I use premodell3d x files for the block shapes.. hell i use x files for everything 3d. the music was made by my good buddy crimson, and the block artwork was made by my other good buddy valacar, http://valacar.waveforms.com (good freakin'' artist).
skybox was given to me by valacar even though he didn''t make it, it was for some quake 2 stage i hear.

anyhow, I''m giving the source to it away since i currently have no plans of finishing it to be internet ready, other then that it''s a fully playable tetris game w/out score saving (was going to get to that.. but well.. you know)

http://www.geocities.com/khaotix/netblocks_src.zip

hope any of this source might help you out. i use BASS library for sound cuz i''m a lazy idiot, and crimson perfers IT''s. I am no longer doing game development because i have nothing to achieve and i see 12 year old kids doing stuff i only wish i could. i posted in another forum some MD2 code i had made that is pretty fast, although the loading code could probably use some sort of optimization although it''s pretty clean and easy to read. it can be downloaded at

http://www.geocities.com/khaotix/md2code.zip

everything posted here is for dx8.0 or 8.0a or some crap.
I am suffering from severe wisdom tooth pain headaches lately so my thought process is out the freakin'' window.

anyhow, if you have any questions about the code or any comments etc, don''t expect immediate reply...

thanks,
Setzor
Khaotix Software Inc.
setzor@hotmail.com

##### Share on other sites
Torn Space    122
You could just use something like this:

int gameBoard[sizeX][sizeY];

then use values like SPACE_EMPTY, SPACE_RED, etc.

-M