Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
INKEY$ TUTORIAL
#1
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.
Reply
#2
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.
Reply
#3
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)