AboutAlex Barry Expertise I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, c/c++, python, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.
Experience Hobby programming since 2000
I no longer belong to any community programming groups, but do have knowledge of *basic dialect and C/C++
Expert: Alex Barry Date: 6/27/2008 Subject: INKEY$ not working in SCREEN 13
Question Is it normal for INKEY$ not to work in SCREEN 13? I wrote a cat and mouse game a while back that took keyboard inputs like...
IF INKEY$ = CHR$(0) + "H" THEN CatY = CatY - 1
...and so on. I tried to copy that exact phrase, except with ManY instead of CatY, into a SCREEN 12 program to move a man like my cat did previously.
It didn't work.
All other aspects of program work fine and I used a simple PRINT statement to verify that it wasn't registering and subtracting 1 from ManY.
I'm very confused; please help me.
Answer Hi, Tracy,
the INKEY$ function works in any screen mode, so it isn't a problem with INKEY$.
Can I see more of your code? You may be doing something that stops the INKEY$ functionality, or something like that.
One tip I will give you though, is to define a 2 character string, call it keypress or something like that, and at the top of your game loop, do this:
keypress = INKEY$
This actually makes your program go a little faster, because it empties the keyboard buffer, which is good.
Also, just in case you didn't know, to make a 2 character string, do this: