# How do I allow two players to play at once using only one keyboard?

**URL:** <https://discourse.processing.org/t/how-do-i-allow-two-players-to-play-at-once-using-only-one-keyboard/3320>\
**Category:** Beginners\
**Created:** [September 6, 2018, 2:37pm UTC](https://discourse.processing.org/t/how-do-i-allow-two-players-to-play-at-once-using-only-one-keyboard/3320 "2018-09-06T14:37:08Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![EnhancedLoop7](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/enhancedloop7/32/1040_2.png) [@EnhancedLoop7](https://discourse.processing.org/u/EnhancedLoop7)\
**Post date:** [September 6, 2018, 3:57pm UTC](https://discourse.processing.org/t/how-do-i-allow-two-players-to-play-at-once-using-only-one-keyboard/3320/2 "2018-09-06T15:57:21Z")

</div>

So I answered a question kind of similar to this, and well this is what I would personally do when it comes to handling multiple key presses. The only problem in your case, is that I do not know necessarily how many maximum keys will be pressed at one time, so you would have to work that out (and we could help out of course if need be).

The question is here:

> [@Key != the pressed key when control is held](https://discourse.processing.org/t/key-the-pressed-key-when-control-is-held/2779/3):
>
> So I borrowed a lot from this old post on an older Processing forum, credit to @GoToLoop : [Check this out:](https://forum.processing.org/two/discussion/16594/can-multiple-keys-be-pressed-on-the-keyboard) And I made some adjustments to fit what I think it is you are trying to do: boolean controlPressed, shiftPressed, vPressed, cPressed; //define all the booleans String keysPressed = ""; //have a string that will compile all the strings pressed String action = ""; //have a string that will display the end action void setup() { size(400,400); } void draw() { background(0); f…

And maybe you can take a look at that and see if it works? Now, as far as I know, technically you can’t really expect for two players to be able to play at the same time. I have made a two player pong game before, and had one player use the keyboard and the other uses the mouse. There might be a way to use two separate keyboards and switch between them but that’s just me being hypothetical 😃 As far as I know, it’s not ideal trying to get two players to use the same keyboard.

Hopefully that helps,

EnhancedLoop7

---

_[View the full topic](https://discourse.processing.org/t/how-do-i-allow-two-players-to-play-at-once-using-only-one-keyboard/3320)._
