quote:Original post by Ekim_Gram
*sigh* I wouldn''t have posted here if I didn''t think about it first. I spent about an hour in a doctor''s office waiting to see a surgeon thinking about it and I came up with a blank. I am programming in Windows by the way. And I''ll as the question(s) once more.
okay, usually it takes being able to try out thoughts in an actuall program.
quote:
1. Since I''m trying to make a tetris clone in ASCII and a console, how do I rotate the pieces
math. try this, on some graph paper, draw a 4x4 grid, and draw a tetris block in it. do it again with the block rotated 3 times (you should have 4 pictures. Be careful to only ROTATE, and not MIRROR the block). Take note of the coordinates of the different points on the block. maybe you will see a pattern (I know I did).
quote: move them with arrow keys (i could figure it out with letters and stuff)
GetAsyncKeyState(VK_ARROWUP); returns true if the up arrow key is currently being pressed. I bet you can figure out the names of the others. it''s in windows.h. Borland compilers have a non-standard header called conio.h that has a function called getch() that only returns if there is a character in the input buffer. Basically, it doesn''t wait around for you to hit a key. After that, it''s math. Like I said, not going to teach you how to add one to a number.
quote:and how do you have the pieces moving downward. I''m guessing it''s using sleep() or something but can somebody explain?if you use sleep, nothing will happen while sleep is taking place. In fact nothing CAN happen. I would write a function that updates your display. then, in my main function, I would have an infinite while loop (while(1)) that I would "break" out of on a game over. in this loop, I would keep track of the time in milliseconds, using the various C/C++ standard time functions. When a certain number of milliseconds is up (remember, 1000 ms to 1 second), I call that update function I mentioned.
But that''s just me...
quote:
2. What would I need to know to do all of the things I listed above? I know a good deal of C++ as some of you now (if you didn''t, now you do) and I''m learning OpenGL but I''m not intending to use that with the game right now.
basically, mostly C with enough C++ to help model your data (though it''s really not necessary).
Do you use your powers for good or for awesome?
My newly updated site | The Cutter Project | Association of Computing Machinery