Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detecting two keypresses at the same time
#1
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.
nd remember kids, only you can provoke forest fires!
Reply
#2
http://forum.qbasicnews.com/viewtopic.php?t=5307
PlayGGY there made a little keyhandler like that. Just ask if you're confused.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#3
I have never used it, but this ( http://faq.qbasicnews.com/?blast=MiloSed...ardHandler ) should do it.
hrist Jesus came into the world to save sinners, of whom I am first.(I Timothy 1:15)

For God so loved the world, that He gave His only begotten Son,
that whoever believes in Him should not perish, but have eternal life.(John 3:16)
Reply
#4
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.
nd remember kids, only you can provoke forest fires!
Reply
#5
at the end of the command line put

/l

that should do it
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#6
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.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply
#7
[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]
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#8
when all else fails... use milo sedlacks keyboard handler Cry
Jumping Jahoolipers!
Reply
#9
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.
nd remember kids, only you can provoke forest fires!
Reply
#10
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)