Help --- Newbie!!!!!!!
Hi,
Just started OpenGL two weeks back and would like to get the fundamentals down, so I have decided to develop a game.
I am right now trying to develop a version of the popular game tetris, but I am not sure if my approach is correct and there is no one nearby who has got stuff! I am using OpenGL and VC++.
I don''t even know if I am on the right track. I am also not sure of the type of shapes in Tetris, been abt years since I played it.
My approach is like this:
I have used matrices to represent the shapes
I have a 20x10 matrix which is mapped to the screen. All the shapes are denoted using a 4x4 matrix. e.g: The matrix below represents an inverted T.
0 0 0 0
0 0 1 0
0 1 1 1
The problem that I am facing is along the boundaries. If you look at the above matrix, the 1''s are donot have a symmetry and at the edges, when I rotate the matrix, the shape goes beyond the edge.
The first thing that came to my mind was to shift the coordinates, but the problem here is that the each one in the matrix denotes a square on the screen and in the loops, where I map the ones to the screen, I can check only the left most one for the left edge and I can shift.
The same problem exists on the right hand side and I reverse the maping of the matrix.
The other complex part (for me) is when the shapes reach the bottom, the large matrix is not filled evenly and I have to scan the matrix each time a shape reaches the end and have to keep track of another matrix which shows the level of filling in each column. I still haven''t taken care of this.
The only thing that is bugging me is that this seems too complicated for a game like this. There must be some other way to do this.
Please help.
It would be really nice if you could mail me at ramresh@dsqsoft.com coz I do not have a net connection nearby!
Tia
Amresh R
Amresh
ramresh@dsqsoft.com
Amresh
ramresh@dsqsoft.com
dArkteMplaR of Delphi
Instead of a 4*4 matrix, maybe you should try a structure which uses a pointer to a matrix.
You have another variable about height and width of the current matrix and a char * to the actual matrix itself. That way, there is no weird movement on rotation.
There are other ways of doing it, like specifically refering to the center of ''gravity'' of the peice, but it should be simple if you think about it logically.
-Chris Bennett of Dwarfsoft - Site:"The Philosophers'' Stone of Programming Alchemy" - IOL
The future of RPGs - Thanks to all the goblins over in our little Game Design Corner niche
![](http://www.gamedev.net/community/forums/icons/icon6.gif)
You have another variable about height and width of the current matrix and a char * to the actual matrix itself. That way, there is no weird movement on rotation.
There are other ways of doing it, like specifically refering to the center of ''gravity'' of the peice, but it should be simple if you think about it logically.
-Chris Bennett of Dwarfsoft - Site:"The Philosophers'' Stone of Programming Alchemy" - IOL
The future of RPGs - Thanks to all the goblins over in our little Game Design Corner niche
![](http://www.gamedev.net/community/forums/icons/icon6.gif)
![](http://www.gamedev.net/community/forums/icons/icon6.gif)
![](http://www.gamedev.net/community/forums/icons/icon6.gif)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement