Multiple Keyboard inputs...

I've finished up a version of Pong for extra credit for a Java class i am taking, and i ran into an interesting situation.
I cannot figure out how to have a two player version of pong have both players control their paddles with the keyboard. The specific problem i run into is, when i enter one paddle to move, and the other attempts to move it stops the first paddle from moving, also there is the whole issue of the key delay that occurs when a key is held down. If anybody can help me out, i would be incredibly greatful.
It seems like it could possibly being done, for example, in games ive played before a character has been able in mid run(holding arrow key) press another key(such as shift) and jump into the air, while still running, to perform a run-jump.
I have tryed setting up a keyboard input test so if both keys are pressed both paddles move. This works for one movement, but have you ever tryed hitting two keys at once in word? they both will display once, their will be that short delay, then one of the two keys will continously repeat.
Any advice? I have it working with one Keyboard input, and the other Mouse input, but the mouse clearly has a big advantage over the keyboard player...
Thanks,
Sean Green

and the repeated key thing still happens as well as the delay....I guess you'll get this as long as you use keyTyped() for player1. Is
there some reason why you're doing this?
What I was thinking of was along these lines:boolean up1, up2, down1, down2;
keyPressedHandler()
    if key is w up1=true
    if key is s down1=true
    if key is up, up2=true
    etc
keyReleasedHandler()
    if key is w up1=false
    etc
drawingCodeOrWhereever()
    if(up1 && !down1) player 1 is on the way up
    (else) if(down1 && !up1) player 1 is on the way down
    if(up2 && !down2) player 2 is on the way up
    (else) if(down2 && !up2) player 2 is on the way downYou may want to handle the case of up and down both pressed
differently.
If getting rid of keyTyped() doesn't help, post some code. An example
simple enough to just show the problem woule be good. Say how
you would make a dot move left-right and up-down indepently.

Similar Messages

  • How do u get multiple keyboard input?

    is there a easy way to do this?
    for ex: while pressing the right key to move a sprite i press the space bar to make it jump

    You could have some booleans that keep track of which buttons have been pressed. For example:
    boolean rightArrowIsPressed = false;
    boolean spaceBarIsPressed = false;You can set them to true in the keyPressed method, then false in the keyReleased method. Does that make sense?

  • Keyboard? Multiple Midi Inputs? CAD U1 Mic?

    Hello (and, HangTime, if you're there, will really appreciate your answer)
    Three questions:
    1. MBPro with Yamaha E403keyboard -- GB11 records notes played with piano function but does not record background drumbeat from keyboard. Suggestions to get the background also? (Have already installed latest midi driver from Yamaha.)
    2. If I acquire an external Mic can GB accept input from it at the same time as the keyboard? (Have multiple USB inputs available on MBPro.)
    3. Any feedback on the CAD U1 Mic? Amazon has it at attractive price for a total novice.
    Thanks.
    (Note -- erroneously posted in GB3 originally.)

    BPWMorro wrote:
    2. If I acquire an external Mic can GB accept input from it at the same time as the keyboard?
    yes:
    http://www.bulletsandbones.com/GB/GBFAQ.html#maxnumrecordabletracks
    (Let the page FULLY load. The link to your answer is at the top of your screen)
    3. Any feedback on the CAD U1 Mic? Amazon has it at attractive price for a total novice.
    i don't think i've seen anyone post about using that, but it'll probably work good enough if you're not looking for pro quality.
    and to the question in your subjectline:
    Multiple Midi Inputs?
    you can plug in multiple MIDI devices, but you can only record to a single track as noted in the link above.

  • Multiple MIDI Inputs Yet???

    Can anyone tell me if LP8 offers multiple MIDI inputs? I use the step sequencer from my Elektron Monomachine for pattern creation and would like to be able to assign the external tracks from it to instrument tracks hosting either native or 3rd party plug-ins. Untill I can assign MIDI to Logic Instruments and third party AU Instruments from multiple channels, I am forced to use another app (Ableton Live at present) for song creation and only use logic for post production of said track. Would much rather keep it all in one app from creation to stage performance!!!

    I have found an answer to my problem. In the following link I found this post that allowed me to play multiple instruments from an external step sequencer. I have been trying to figure this one out for ever and just kept giving up with the environment. Now I can finally use logic the way I always wanted to!!!
    http://discussions.apple.com/thread.jspa?threadID=1078171&tstart=30
    Here is the post...replace "MIDI Keyboard" with "Sequencer Track" and you can see how this worked for me...
    This method assumes that One MIDI Keyboard is sending on MIDI channel 1 and the other is sending on MIDI channel 2.
    In the Environment, go to the "Clicks and Ports" Layer. My MIDI "signal" path is:
    Physical Input-->Input Note (a keyboard)-->Input View (Monitor Object)-->
    "to Recording and Thru"
    (See p. 207 of the LPReference for more on the "The MIDI Signal Path")
    What I would suggest is this:
    Create a "Channel Splitter" object from the "New" menu. Then cable the MIDI output of the Input Note (the Keyboard object) to the Channel Splitter. This is a second MIDI output cable from the Keyboard, make sure the keyboard object remains connected to the Input View (monitor object).
    Now create two "Alias" objects. In the Alias' Parameters box, set the "Reference" box to the Audio Instrument you want to hear when you play the MIDI channel 1 keyboard. (There are other ways to do this without alias objects as well.)
    Now cable the MIDI channel 1 output of the Channel Splitter (second from the top) to the Alias of Audio Instrument (the one to be heard when playing the Keyboard on MIDI channel 1).
    Create a second Alias, set its Reference to the second Audio Instrument and cable the Channel Splitter's MIDI channel 2 output to the Alias.
    Now go the Arrange. Create a new track and Assign its output (click-hold on the name of the track) and select the "Input Notes" object (mine was under the "Clicks and Ports" submenu). Now when you've got the Input Notes track selected in the Arrange, the MIDI notes will be sent to the Audio Instruments based on MIDI Channel. You can record the notes on the Input Notes track. Later, you can "Demix" the notes and put the Demixed regions onto the tracks of the appropriate Audio Instrument.
    End Post
    For now I am using only one port on my AMT8 for input, the next step will be to try multiple port / multiple sequencer input scheme and see how that setup works...
    Hope this is helpful to someone

  • International keyboard input

    This is not really a problem, just wierd.
    I have my computer set up for multiple languages for keyboard input. This works great for the most part, but occaisonally changes input langauge randomly.
    I have only been using the standard American English method for some time, but it has recently switched to French, and U.S. Extended. This use to happen before when I switched back and forth. Sometimes an application would be using a different language than the O.S. Sometimes it would switch into Greeek, which I use very rarely.
    On my last reboot, I found with a French Keyboard.
    Is there any reason for this? Does this make any sense?

    I need to use Bulgarian language. Whether be supported Bulgarian language in the future.

  • Modifier keys with multiple keyboards / keypads

    I've got a weird one. I'm running 10.6.2 on a Mini with a Kinesis Freestyle Mac keyboard. I also just got an Ergodex DX1 input system with the Keyjack Mac software. It's amazingly cool, but there's an issue that the company says is an OSX bug/feature: the modifier keys on my main keyboard don't affect keys I've programmed on the DX1. For example, I have keys programmed as the cursor keys. However, I can't get cmd-up, shift-up, etc, using the Kinesis command and shift keys.
    This is a pain and required me to waste the limited DX1 keys to have its own modifiers. Is there some way around this? I've read many threads about weird behavior with modifier keys and multiple keyboards, but haven't seen this specific issue.
    Thanks for any help!
    David

    Something similar was asked before where the person wanted to use multiple keyboards ("standard" keyboards, but one for each hand.) It was found that the modifier keys worked only for that device. (e.g.: shift on left keyboard did not affect shift status on right keyboard.) It appears to be a limitation with most modifier keys on any keyboard, PCs included. The way most keyboards work, (at least most USB keyboards,) a code is sent with the appropriate "letter", not which key(s) are press. IOW, there's a code for "s" and "S", but not "shift-and-s". Unlike Caps Lock, the Command key is more like the shift, control, option keys, which do not have separate "codes" of their own.
    So unless someone else has some other idea to try, I think you're out of luck.

  • Usb 6009 multiple analog inputs

    I am currently attempting to sample two different analog inputs at different sampling rates using a USB 6009.  I keep getting the 'resource reserved' error and am wondering if this is not possible using this DAQ.  Questions:
    1.  Does creating two analog input channels on the device cause this error?
    2.  Is it possible to sample at different rates on channels created in the same task?  (i am trying to 'slow down' the second analog input to display switch points to a customer)
    3.  Running multiple analog inputs using independent timing would be better achieved by switching to a higher end DAQ?  If so which would you recommend?
    I have attached my vi.  Thank you in advance for your help. 
    I surf therefore I am....
    Attachments:
    demo_nolvl.vi ‏27 KB

    The DAQ boards only have 1 timing clock for the analog inputs/outputs.  So you can only have 1 sample rate on a given card.  I would recommend just sampling at the highest of the desired rates in a single task.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • TS3280 How can i enable both paired bluetooth and ios keyboard input at the same time?

    How can i enable both paired bluetooth and ios keyboard input at the same time?
    This is needed for the app im working on. Need some user input via keypad as well as scanner input via a paired bluetooth scanner.

    You probably should not be using a keyboard bluetooth profile for a scanner, I am not a developer for apple so do not know the location for you to find out the correct profile you should be using for an input device that is not a keyboard. Sorry,
    I am sure if you navigate the apple developer site you will probaly finmd what you're looking for.
    https://developer.apple.com

  • Synchroniz​ing two counter frequency inputs with multiple analog inputs

    Hello all,
    I'm fairly new to LabVIEW and I'm trying to collec​t data from multiple sources with synchronized tim​ing on the acquisition but I'm having trouble figu​ring it out. My problem is that I've got two count​er frequency inputs, one optical tachometer readin​g one pulse per revolution, and a max machinery fl​ow meter with a k factor of 12000. I can't seem to​ figure out how to sync the timing with my multiple analog inputs. I've be​en attempting to get the tachometer  to sync with ​the analog inputs first by following the example l​inked here. (https://decibel.ni.com/content/docs/DOC-10785) So far each time I run it I either get a timeout e​rror on the DAQmx read or a "Multiple sample clock​ pulses were detected" error (see attached image).  It seems if I slow the sampling rate way down to ​say 10 hz and ensure that the tachometer signal is​ over 800-1000 RPM (13-17 Hz) before starting the VI then the program will run without errors until ​the RPM drops below that threshold then the "Multi​ple sample clock pulses" error occurs.  The code is attached below.
    Does anyone know of a more effective way of syncin​g counter frequency inputs with analog inputs?  I'd like to have a VI that can show 0 RPM (and ev​entually 0 flow as well, but I think I need to fig​ure out the timing of one counter before I add ano​ther as it seems I can't have two counters in the ​same task). Any help on this would be greatly appr​eciated.
    LabVIEW version 13.0
    cDAQ-9178 Chassis with NI 9401 for the two counter inputs and NI 9205 for the analog inputs.
    Thanks!
    Richard
    Solved!
    Go to Solution.
    Attachments:
    SimpleDAQ.vi ‏44 KB
    LV_Error.JPG ‏31 KB

    Maybe third times the charm? 
    So I've finally got a good handle on why the VI is having problems at low RPM though I'm somewhat embarassed how long it took me to do that
    Because I have the counter time synced to my Analog input task if it doesn't see at least two pulses between the two clock pulses set by the analog input task I get the -201314 "Multiple sample clock pulses" error. This seems fine at first as it just sets a minimum RPM that I can measure and it's well below the area I'm interested in so no problems there.  I tried a simple error handler that would clear the error when it happend assuming the loop would keep iterating until the RPM went above that minimum at which point I would get a signal again. This is not the case, the read function just continues to spit out the -201314 error even after the RPM is back in the readable range. So then I tried adding two case structures so that when the error occured it would stop the task, clear the error, and then start the task again on the next loop iteration (Code Attached). This also doesn't work as the error shows up again on the stop task and then AGAIN on the start task on the next loop iteration. It seems this error is not actually being cleared and once it happens it stays with the task regardless of what the error cluster is carrying. 
    Anyone have any ideas?  The only solution I can think of is to just clear all tasks and recreate them each loop iteration until the RPM is readable again but that strikes me as a horribly clunky solution.
    Richard 
    Attachments:
    SimpleDAQ_1_Start Stop.vi ‏48 KB

  • I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input not working to enter my password. Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    I have a new mac book pro (sept 2014) and am suddenly stuck on the log-in screen. Keyboard input is not working to enter my password. Seems to be a log in issue as keyboard works for forced troubleshooting. (And b/c when I first noticed the problem, I was able to enter my log in password but then everything sort of froze. Now, no ability to enter the password.) Already tried a basic restart and a cmmnd/ cntrl/ pwr troubleshoot to no effect.

    Reset PRAM:   http://support.apple.com/kb/PH14222
    Start up in Safe Mode.
    http://support.apple.com/kb/ph14204
    A new Mac is in warranty for 1 year from the date of purchase.
    A new Mac comes with 90 days of free tech support from AppleCare.
    AppleCare: 1-800-275-2273
    Call AppleCare or take it to the Apple store to have it checked out.
    Genius Bar reservation
    http://www.apple.com/retail/geniusbar/
    Best.

  • How to have same keyboards input source in Mac and Windows???

    I use Canadian French-CSA on my Mac keyboards input source. Using Windows 7, I can't find the good setting for my keyboards to be the same when I it keys.
    I run Windows over Parallels Desktop
    Can anybody help?
    Thank you

    Can I use an AirPort Extreme Base Station "n"
    Yes.
    and if so, will my MacBook work with this at maximum download / upload speed (i.e. equivalent to the cable)
    The speed of your internal network generally is much much faster than the speed of your internet connection. Unless he has an internet connection faster than approx 6Mbps then even dropping down to the old 802.11b Airport would not seen any decrease in speed of downloads etc...
    and will my brother's PC's also be able to connect?
    If his PC is 802.11b/g-compliant, it shouldn't have any problems connecting to the AirPort base station.
    Or is there another Airport base station?
    The other AirPorts would work, but the AirPort Express & older 802.11g AirPort Extreme base stations have a max. range of 150 feet.
    OR-- should I head down to "Generic Computer Store" and just by a wireless router (WiFi)(think that's what they call them) and connect this to his cable modem? IF SO WILL THAT WORK FOR MY MAC?
    That is always an option as well, especially since he will be the primary user throughout the year. I'd suggest going with a brand name, like Belkin, D-Link, or Linksys for the wireless router choice.

  • How to use the phone's Mini-Keyboard Input with the 'Textbox'(MIDP2.0)?

    (My apology. My English is not perfect but I'll try my best. >_<)
    Hi. I'm trying to create a textbox(in my own little application) that is compatible with the mini-keyboard input feature.
    This problem involved any device that have a built-in "mini-keyboard".
    Problem:
    I tried the 'Textbox' class from MIDP2.0 but the result, as expected, is like using the phones with no built-in keyboard.
    (Forexample if I want to input the character 'C' inthe text box, I need to press number '2' button three times to let it circle through 'A' -> 'B' then 'C'. )
    Then I tried entering URLs in the phone's built-in web browser, the result is I can use the mini keyboard to type like a PC keyboard.
    Question: How do I implement such textbox that is fully compatible with the built-in mini Keyboard?
    I tried browsing through the MIDP2.0 API but it seems the 'Textbox' class there couldn't do it.
    Thank you. =)
    /bow
    Edit/Delete Message

    The textbox should have input just as any other normal phone input. If not, something strange is going on.
    Anyway , there is no use to make your own input method, since every phone has another implementation of this anyway. It would only confuse users.

  • Firefox and Thunderbird are suddenly not accepting keyboard input

    Keyboard shortcuts still work just input in any kind of input field fails so I can still use ctrl+C / CTRL+V to somewhat use firefox and Thunderbird But all input fields are completely unresponsive to keyboard input
    The problem suddenly arose while I was browsing.
    I have the same issue on all program's based on the Gecko engine and I confirmed them so far in Firefox, waterfox, instantbird, thunderbird and fossamail. However chromium / windows / basically everythign n
    To fix it I tried the following:
    Restarting firefox
    Restarting firefox in savemode
    Rebooting
    Changing the keyboard layout in windows
    Using a different keyboard
    Again rebooting
    Pressing F7 to check for caret mode which was disabled
    pressing winkey + F9 (Whatever that does)
    I am running windows 8.1(x64)

    Solved, Changing the keyboard layout again and rebooting fixed it. I tried using the on screen keyboard which worked so I changed the keyboard layout again and rebooted and now it works just fine. I still wonder what caused a Gecko wide issue like this?

  • Default Keyboard input change in using roaming Profile on different Win 7

    We found a strange problem on default Keyboard setting.
    We are using roaming profiles for all users.
    One of our users is using two Windows 7. One Windows 7 is VDI for working out of office and another Win 7 is her local PC.
    She is only using Two keyboard input: Chinese Traditional English and Chinese Traditional Pinyin.
    Whenever she had used the Windows 7 VDI, when she comes back to office and use her local PC, the default Keyboard input will automatically change to Chinese Traditional Pinyin.
    The user said she had not changed any default keyboard input in the VDI of local PC.
    Is there anything we can do for this issue?
    Ivan

    Hi Ivan,
    I am just writing to check the status of this thread. Was the information provided in previous reply
    helpful to you?
    Do you have any further questions or concerns? Please feel free to let us know.
    If you have any feedback on our support, please click
    here
    Karen Hu
    TechNet Community Support

  • CS3 Language Keyboard Input Error

    Greetings All,
    I have been trouble-shooting this problem for a while, but still it is not resolved. Any help or ideas would be gladly received!
    Background: We have a correctly functioning installation of Win XP, and PS CS3 Extended which appears to work normally in every other regard. No obvious errors; no crashes, no start-up complaints; nothing seemingly out of order. I use several installed languages in Windows (EngUK, Russian, Swedish, etc). All of these work normally. All of my installed fonts work correctly in every application on the system except for CS3.
    There would appear to be something wrong with CS3's keyboard mapping in foreign languages. When typing with a non-English keyboard setting (any other language) and using TrueType fonts (not Open), only 'missing character' boxes appear in the artwork. The Layers menu displays the typed text correctly, but this will not appear in the artwork. If I use an old install of PS7, I can type using these same fonts correctly in any language. These layers can be imported into CS3, and these WILL display correctly on the artwork. However, the Layers menu in this case displays nonsensical characters. Ergo, I suspect that CS3's keyboard input data is errant.
    Where does PS3 keep its information regarding language / keyboard layout? It is possible to edit this file(s)? Are there any other ideas regarding this problem and what might be wrong?
    Thanks

    Unicode vs. non-Unicode. Turn off glyph substition in the character palette.
    Mylenium

Maybe you are looking for

  • Stanging indicator change in control cycle after production order released

    HI We have MM PP interface active i setup staging indicator 4 for one material via control cycle Production order is created and released now we would like to change staging indicator to 1 [pick parts] how we reread control cycles data in production

  • Selection screen parameter validation using search help/check table

    Hi experts, I have a select-option that is tied to a search help and check table (type tq80-qmart). Is there a way to automatically validate the field based on what comes up in the F4 search help? What I mean is, when the user hits F4 on the paramete

  • Flash Video on IE, Safari, etc...

    I've worked with Flash/Dreamweaver for a while now, but I can't seem to figure out what I'm doing wrong now... I had flash videos playing on my site before, but I completely changed the look of the website... and added new .flv files. When I test it

  • Custom Permission Level Contribute No Delete not working

    I have created a custom permission level that is the same as OOTB Contribute, except it doesn't have the Delete Items nor Delete Versions. In my document libraries, I have "require documents to be checked out" set to Yes. This is causing some strange

  • Messages+ Sending Issues (HTC One M7)

    I have been having trouble sending text messages when my WiFi is connected. Usually no trouble when it isn't connected. Message says sending for a long time and sometimes it sends but doesn't say it was sent. What can I do to fix this?