Posted: Fri Jan 09, 2004 11:16 am Post subject: getch help
ok, im making tetris for a school project, and i dont know how to do a getch to turn the pieces. i have all the positions redrawn and stuff, i just dont know how to do a getch thing. any help would be swell.
Posted: Fri Jan 09, 2004 2:39 pm Post subject: (No subject)
It's easy..just tell me if th e pieces are picture (bmp) files, or just regular drawbox/drawlines?
var key :string(1):=""
if hasch then
if key =(KEY_RIGHT_ARROW) then
elsif key=(KEY_LEFT_ARROW) then
The if hasch then means that if the computer senses that a key has been pressed on the keyboard, it will getch the key and place it inside the key variable. (Which can contain a max of 1 char in it. I hop this helps.
Posted: Fri Jan 09, 2004 4:55 pm Post subject: (No subject)
actually hasch just returns true if there's an unprocessed character in the input buffer. if you were to loop hasch without using getch to clear the buffer, it will run indefinatly from a single key stroke