Tetris clone in an hour with C++.

Started by
148 comments, last by jbadams 12 years, 1 month ago
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.

Thanks a lot for the help and for the great tutorial!
http://www.goosey.orgAIM: DarkGoosey ICQ: 14128911 MSN: DarkGoosey@hotmail.com Email: Goosey@gmail.com
Advertisement
nice job! thanks man
Very cool, very impressive, and very nice of you to do such a thing.

Two thumbs up.

_________________Politics is the ability to foretell what is going to happen tomorrow, next week, next month and next year. And to have the ability afterwards to explain why it didn't happen. -- Winston ChurchillGDNet-0.2 - rate users the easy way with this nifty Firefox extension. Updated with new features.
Awsome. Definitely article worthy.

When you find yourself in the company of a halfling and an ill-tempered Dragon, remember, you do not have to outrun the Dragon...
Without order nothing can exist - without chaos nothing can evolve.
I''m so glad this was re-stickied. It is awesome and a great tutorial!
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???

Not sure what to do...
Did you create the bitmap file that it requires?

-Greven
I just copied the bitmap file from his tutorial
Well, I don''t have VS.NET but it sounds to me like the program is exiting immediately, if nothing is showing up at all.

This could be caused by a few things. Check your WinMain() function to see if it is correct, and also check TheWindowProc() function.

For instance, if in TheWindowProc() you happen to have:

//check for escape keyif(wParam=VK_ESCAPE)				{DestroyWindow(hWndMain);				return(0);//handled message	} 


instead of:

//check for escape keyif(wParam==VK_ESCAPE)				{DestroyWindow(hWndMain);				return(0);//handled message	} 


You won''t recieve any errors... and it will exit instantly and you''ll never even see the window created.

Check for something like that.

-Greven
Wow. If this is the basics of basic game programming, I'm screwed!

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.

[edited by - ArtGeek on April 16, 2004 11:06:12 PM]

[edited by - ArtGeek on April 16, 2004 11:41:18 PM]
----------------------RobynThis is probably some really stupid problem that can be fixed with the push of a button, but there''s a lot of buttons, and I don''t know which one to push.

This topic is closed to new replies.

Advertisement