Archived

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

ok where...

This topic is 5237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok it tells me to start out with a tetris style game i am the one with no game programing EXP. where can i find a place tht i can find out C++ to get started on tetris i deeply appreciate everything thank you sencerily. the idiot [edited by - SG_voc on August 12, 2003 1:13:02 PM]

Share this post


Link to post
Share on other sites
If you don''t know programming, you''ll have a hard time programming Tetris. Get a good book on C++ from a bookstore. Several good books are listed in the "Books & Software" section of this site.


How appropriate. You fight like a cow.

Share this post


Link to post
Share on other sites
Hi,
Have you learnt any c/c++? functions, datatypes, pointers??
if not then id get a nice book on c or c++ and read through that, just codeing teris from scratch wont be easy, maybe im wrong and you do know c or c++,

anyway good luck either way,

cheers

lol beaten to it, hehehe

[edited by - Emexus on August 12, 2003 12:45:40 PM]

Share this post


Link to post
Share on other sites
First, get yourself an introductory C++ book. I used to like the Waite Group Press C++ books, but their might be better books these days. Study up on functions, arrays (1D and 2D), looping, conditional''s and data types.

Then once you''ve got the basics down, get a copy of SDL, a cross platform game programming library and READ the documentation and experiment. Don''t try to make a full game with it until you can throw a dart at a header file and then describe from memory what the function you hit does.

Tetris is a pretty easy game. I built a tetris clone once, and here''s how I did it.

For one, the playing area was a 2D grid of cells. I had a C++ class for each kind of piece. These classes know what cells in the grid to turn on to draw themselves (they kept the grid relative X,Y of their center piece). They also knew how to rotate themselves.

All games have a main loop that must always be looping, so you can never write code that waits permanently for the user to hit a key or something.

To get pieces to fall you have to use timers. When you create a piece it gets the current time. Each time through the main loop it get the current time again, if the difference between the new current time and the first time it got is greater than some pre-determined amount, it would move down.

Because Tetris is so EASY for a computer, my game used some pretty bad techniques that worked and were easy to program. For one, when I determined if it was time to move a piece I would move it, then I would check to see if any of it overlapped another piece (by simply iterating through each square), if it did, I would move it back, and then lock it into place.

Anyhow, you''re first step should be to get a 2D array, where each element of the array is a struct that has information about that square (I.E. is it on? if so, what color is it?).

Then write code that walks the array and draws a visual representation of it onscreen.

Tony

Share this post


Link to post
Share on other sites