Qbasicnews.com

Full Version: Detecting two keypresses at the same time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm making a two player game and I need a way to detect both players buttons at the same time and possibly each player pressing more then one. Obviously, I can't use INKEY$ because it only returns one button. I'm dumbfounded, Thanks.
http://forum.qbasicnews.com/viewtopic.php?t=5307
PlayGGY there made a little keyhandler like that. Just ask if you're confused.
I have never used it, but this ( http://faq.qbasicnews.com/?blast=MiloSed...ardHandler ) should do it.
Quote:I have never used it, but this ( http://faq.qbasicnews.com/?blast=MiloSed...ardHandler ) should do it.
I tried this out but when I ran the program it gave a bunch of errors. Such as when it tried to CALL ABSOLUTE(#) it said subprog not defined. I ran it on QBASIC 7.1.
at the end of the command line put

/l

that should do it
To explain further...
Open an MSDOS prompt. You know, the little box that lets you issue MSDOS commands.
CD to the directory of QBX.EXE.
Type: QBX /L
Load the file, and run.
[offtopic]he asked for an answer not a detailed explanation[/offtopic]
or if you are to lazy to do all of that use the other key handler, it works without hassle

[offtopic]there should be a phpbb mod that in the profile you can click a checkbox thingy and you can view things with in offtopic tags or not![/offtopic]
when all else fails... use milo sedlacks keyboard handler Cry
Yay! It works! I'll try it in my program sometime today. This should still work when I compile my program, right?

Oh yeah, is there someway to access a game pad with QBASIC? I figure it uses INP statements, but don't know which port.
DirectQB has a good joystick routine. For T.A.N.K, I used a keyboard handle for player one, and a joystick for player 2. There is a problem which I encoutered and discussed a while back about the keyboard only allowing certain combinations of keys to all work together. What I mean is that certain combinations of keys(over 6 probably), they won't all work at the same time. There are combinations that will allow 8 keys(possibly more) to be used at once, but it depends on your keyboard matrix(open you keyboard and you'll know what I mean). So you would have to find a combination that is right for you, or if it's for another person, have a program that you can test which keystrokes work together, and make the game so you can customize your keys.
Here's something interresting I found:
http://www.dreamcliff.com/personal/danie...index.html
Plans to build your own multi-joystick interface to connect through your parallel port. Can support u2-5 joysticks at once. Any console joystick can be used with a little re-wiring.
Pages: 1 2