Posts: 22
Threads: 9
Joined: Mar 2004
Is there any good more advanced tutorial on the INKEY$, than the one on this site.
I would like to know how to like draw a guy who walks around the screen etc.
Posts: 3,616
Threads: 287
Joined: Jan 2003
You mean to control a guy to make him walk around the screen?
INKEY$ is simple. It's exactly like INPUT, except it only takes a character if there is one waiting. If not, it won't wait, but will just leave itself empty, and go on.
Code:
DO
KeyPress$=INKEY$
IF KeyPress$="q" THEN END
LOOP
See? Simple as that.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 4,307
Threads: 63
Joined: May 2003
I think you may like this =)
Code:
CLS
DO
KeyPress$ = INKEY$
IF LEN(KeyPress$) = 2 THEN
ScanCode% = ASC(RIGHT$(KeyPress$, 1))
END IF
IF KeyPress$ = CHR$(27) THEN LOCATE 1, 1: PRINT "You hit the ESC key!": END
SELECT CASE ScanCode%
CASE 72
LOCATE 1, 1: PRINT "UP ARROW "
CASE 75
LOCATE 1, 1: PRINT "LEFT ARROW "
CASE 77
LOCATE 1, 1: PRINT "RIGHT ARROW "
CASE 80
LOCATE 1, 1: PRINT "DOWN ARROW "
CASE 59
LOCATE 1, 1: PRINT "F1 Key "
END SELECT
ScanCode% = 0
LOOP