Thx for the help Greven. I found my error.. I had decided to use an enum instead of the const int''s for the list of TILECOLORs.. Well in the prototype I had accounted for this alteration, but I did not anywhere else in the code! Have it working perfectly now.

Hi, i was able to get all the code to compile on VS.NET 2003 (i created a blank win32 project for this) but when I try to run it, nothing happens, no errors, nothing. Has anyone else had this problem???

No, really. I kinda understand what's going on in the tutorial, but not enough to be confident in creating my own tetris clone without the help of the tutorial.

It isn't that the tut is bad, its just hard for me, personally, to learn from just looking at/typing up someone else's code. It doesn't click for me.

In order for me to learn well, I generally have to tinker. I've done some tinkering with the things I understand here (changing the size of the tiles and such) but I need some guidance as to how this code can be changed and what the changes would do.

I already have some ideas, like I'm guessing that if I changed the numbers [-][-] in the switch (newblock) statement I'd end up with some pretty funky looking block groupss! I also suppose that I could fairly easily ADD groups of blocks to the game so long as I make appropriate changes to the newblock=rand()%[number]; line.

Any other suggestions for tinkering that would help me understand the code better?

Thanks for the tutorial btw. I read that article that said the first step to learning to program was making a tetris clone, to which I responded 'Well, how do I do that?' Now I can find out... eventually.

I want to add the ability to ''land'' a group of blocks by pressing SPACEBAR. I''ve tried several things, but none of them have worked very well. I''m thinking that I might have to create an entirely new function to pull this off, but the only way I can see to do this would involve duplicating a bunch of code in the Move() function.

Can someone please give me ideas on how to do this with the least amount of code?

Well, it''s your code, so do whatever you want with it. Suggestion wise... well you could add a Top Scores portion, which shouldn''t be too long. You could also add a Menu system with options etc (and then make it Mouse compatible to boot). That''s what I did to finish up my first Tetris clone... polish!

Also, lemurion is correct that that portion is rather useless. Can''t say I made the tutorial without errors, I guess

Now, to land a piece, you could do it pretty easily.

Create a global variable called Dropping or something... make it a boolean/int just as a flag for yes/no. You could set the flag as true(1, whatever) with Spacebar if you wanted in TheWindowProc().

Next, in the Move() function, in the if(CollisionTest(x,y)) {}code block, you would set the Dropping flag as false to halt movement. Then in the else {} portion, you could put an if(Dropping) Move(0,1); after the sPiece.y+=y;

Urm. Silly me forgot to define what I meant by ''land.'' I had intended to, but I think I cut it out while I was shortening my post.

When Spacebar is hit, I want the dropping block to drop all the way down immediately. I tried to figure out some sort of equation that could be sent to the move function (my best shot was move(0,MAPHEIGHT-sPiece.y) but I can''t figure out anything that would work properly.

If I understand your post, Greven, that just sorta ''pauses'' the game. Useful, but not what I was looking for.

To appeal to all people out there, I converted Evil_Greven's code (which he deserves all the credit) for use with SDL. I hope this will help more people out because I am sure Evil_Greven wants to reach all people (Not just Window's users, but Linux as well).

EDIT: Be sure to Link the appropriate SDL libraries:sdl.lib sdlmain.lib

//=============================================================================//FALLING BLOCK GAME!//main.cpp//Needed for all the SDL stuff#include <SDL.h>//need this for srand and rand#include <stdlib.h>//Used for Error checking#include <iostream>

//-----------------------------------------------------------------------------void Blit(SDL_Surface *Dest, int DestX, int DestY, SDL_Surface *Src, int SrcX, int SrcY, int SrcW, int SrcH) { //Create a 2 Rects. The first is for where we want to Blit to. //The other is for clipping the 'Src' so we only draw the portion we want

first, sorry for being a complete newb, hehe. but i was wondering a couple things if anyone would be so kind to help.

im trying to understand the timing rate at which the block falls. right now it looks like it is just set to x+=x,y+=y.if i was to edit that it would just cause a "jumpy" effect to the blocks. so i guess the question is, is there a way to edit the falling rate or can u point me in the direction of creating one?

secondly, the "Grey" side panel where the next block is displayed, where is the grey color set. the GREY variable is just an int which dictates the width. but where is the color set?