Tetris game help

Started by
17 comments, last by DarkAvenger 23 years, 7 months ago
I wouldn''t use the sleep function if you really wanna learn so game programming check out the QueryPerformanceTimer, and QueryPerformanceFrequency they are what a lot of commercial games use or used I think. Anyways check out the tutorial here and you will learn how to use an accurate timer which can be used later on for beautiful things, like governing the speed of your game.
"Don't make me come down there..." -GOD
Advertisement
you know what the fuck, you should stop programming games, go to your fucking room, stick your face in a pillow until you stop breathing you fucking retard. you cant even figure out what the fuck to do with your fucking meager tetris game. i swear, if i had a dime for every dumb motha fucker who wanted to try and program tetris i would be high as a fucking fucker. so fuck you and go kill yourself.
Pay no attention to the anonymous poster above... Some people must find it really amusing to insult others anonymously...

Your first question was a bit strange... But I''ve asked such questions before, when I was in your situation

There are different ways of timing your game... but a simple one is to do something like this:

    #include < windows.h > //needed for GetTickCount()#define UPDATE_INTERVAL 30DWORD StartTime, CurrentTime;int main(void){initialize();StartTime=GetTickCount();while(1) {  CurrentTime = GetTickCount();  if(CurrentTime >= StartTime + UPDATE_INTERVAL)   {  get_player_input();  process_input();  render_frame();  StartTime = CurrentTime;  }}}    

Note: I usually don''t use GetTickCount() and such.... so I''m not sure that this pseudo-code is correct...
Another way of timing your game is to store the speed of all moving objects, and then do something like
current_X += X_speed*delta_time; 

Game programming is basically about showing bitmaps at different places... and move them in a certain way...

//Ksero
i done a version on me site with source its opengl so it should be pretty easy to understand

http://members.xoom.com/myBollux
zedzeek, your site isn't up

DarkAvanger if you're confident in C/C++ ... 'nuff said
Buy a game programming book!!! Or a DirectX Book.
You'll fall in love with Lamothe's "Tricks of the Windows Game Programming Guru's".




Edited by - gi-centerprintf on October 8, 2000 8:56:31 AM
it is up just half the time u cant log in (u gotta keep trying), which brings me to my own question are there any decent free webhosting sites around, ive tried geocites,homestead,xoom and theyre all not much cop. my critea? is
*at least 50mb storage
*ability to upload files with ftp
*when i try to login i can log in unlike where i am at the moment xoom,
(click)
website not available
WHY NOT (click)
that page does not exist
YES IT DOES U BASTARD I WAS LOOKING AT IT A MINUTE AGO(click)(click)

http://members.xoom.com/myBollux
Hey I''m new to programming too... But anyway, I think a good book to start with is "Tricks of the Windows Game Programming Gurus" like gi-centerprintf mentioned. In there it recommends using the GetTickCount() function, like Ksero said.
I made a pong clone first, instead of tetris... and I still can''t get the damn ball to bounce the right way off the ends of the paddles! I''ll get it right soon, I tell you. And for rotating the bricks, I guess it depends... you could make different bitmaps for all the different positions of the blocks, or make one square block bitmap and stick them together to make the different shapes... there are a ton of ways to do it.
quote:Original post by Ecco2000

I wouldn''t use the sleep function if you really wanna learn so game programming check out the QueryPerformanceTimer, and QueryPerformanceFrequency they are what a lot of commercial games use or used I think. Anyways check out the tutorial here and you will learn how to use an accurate timer which can be used later on for beautiful things, like governing the speed of your game.


I''d stay away from QueryPerformanceTimer unless you _really_ need the precision. For tetris, and most games, GetTickCount will do fine.



Toby Jones
Software Design Engineer
Sonic Foundry, Inc.
Toby JonesSoftware Design EngineerSonic Foundry, Inc.
Here you have poorly commented tetris clone code. I hope it''ll help you!
http://members.xoom.com/IgaNinja/ClontrisDev.zip
The Clontris.txt file is in spanish, but if you any doubt feel free to ask: iga@wanadoo.es
Good lock with your game!

This topic is closed to new replies.

Advertisement