| Tetris - display problem |
| unclear |
|
necron
|
There are lots of things that don't make sense to me about the code. I think you are on the right track with removal or commenting out of the stuff that does not need to be there untill all of the blocks can be displayed. It seems like pieces should have a color element added. Anyway if you get rid of the stuff and link or post the code I could figure it out pretty fast but it's hurting my head as it is. The way the data is used from one array to the other may not match up and the off by 1 thing could mess u up too (have 4 of something but count 0,1,2,3,4 which is really 5 things).
|
|||||||||||
|
|
||||||||||||
| Re: unclear |
|
SmokeScreen
|
http://www.sendspace.com/file/54ejxr The whole file with code and image files as asked. Hope u can find the issue. Cheers oh, currentXPos, and currentYPos are nothing other than a value pointing to where compared to gameArea[][] is the block located, if its 0,0 that means the top left element of 4x4 block, is located in 0x0 element of gameArea[][] |
|||||||||||||
|
|
||||||||||||||
|
necron
|
Cant pass an array to a function for one unless each part is seperate. There may be a fancy way to get around that but globals that are not passed as parameters is an easy and direct way to fix it. Also this:SDL_Rect clip[COLOR_NO]; is an array that holds seven rects correct? It looks like it's not treated like that if I'm correct.
The entire thing would be much more clear if we just use one type of array like maybe int block_id[200]; int block_type[200]; int block_row[200]; int block_cullum[200]; int block_X[200]; int block_Y[200]; int block_color_was[200]; int block_color_is[200]; int block_color_turning[200]; int block_face[200]; int block_in_motion[200]; int block_destX[200]; int block_destY[200]; and #define MAX_BLOCKS = 199; or something like that. Could just add onto pieces >>edit>> Here is a simple update to help you get rid of the Uint32 issue I had to resolve before I could get the code to rune in a msv compiler. It also makes the code more compact and simple but I use c++ not strict c so I'm not 100% that all of my code, to include this, will work for you>: SDL_SetColorKey(item, SDL_SRCCOLORKEY, SDL_MapRGB(item->format, 0, 255, 0)); SDL_SetColorKey(frame, SDL_SRCCOLORKEY, SDL_MapRGB(frame->format, 0, 255, 0)); //notice I changed trans to green and the lines before these should be deleted >>edit>> The file has 7 sets of 4, and each of the for has 4 int components so I have no idea what the 10 by 15 block has to do with the file data. Is it a pattern that you wish to replicate with the blocks in the box somehow? |
|||||||||||
|
|
||||||||||||
|
SmokeScreen
|
I already stated it, there are 2 separate arrays we have to use, 1 is for the board and for the static non moving blocks which is the array 10 by 15. and the second one is a pieces array that holds the pieces. I dont really have an SDL problem i think, but the function displayMoving is causing issue's which i cant seem to find. And as i said earlier, the code is messy, so trans a r diffrent, they will be changed when i start cleaning up the code, so its not that important anyway. The problem is the pieces display which is somewhat related to the for loop inside displayMoving() |
|||||||||||||
|
|
||||||||||||||
| need a baseline understanding of what is required |
|
necron
|
#1
Whut? The file has 7 sets of 4, and each of the for has 4 int components so I have no idea what the 10 by 15 game area has to do with the file data. With no understanding of what the data represents I can't say what to do with it. What do you expect to happen with this data? #2 You say "the "pieces" blocks dont rly display at all (movingBlocks(), cant figure out whats wrong. There are no syntax error's" I don't see that displayMoving() ever gets called. What do you expect to happen with this data? |
|||||||||||
|
|
||||||||||||

