
-----------------------------------
bigtuna
Fri Jan 09, 2004 11:16 am

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.

-----------------------------------
DanShadow
Fri Jan 09, 2004 2:39 pm


-----------------------------------
It's easy..just tell me if th e pieces are picture (bmp) files, or just regular drawbox/drawlines?

var key :string(1):=""
var pos:string:=""
loop
if hasch then
getch(key)
end if
if key =(KEY_RIGHT_ARROW) then
pos:="rotate right"
elsif key=(KEY_LEFT_ARROW) then
pos:="rotate left"
end if
end loop

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.

-----------------------------------
Tony
Fri Jan 09, 2004 4:55 pm


-----------------------------------
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
