The Daily Click ::. Forums ::. Klik Coding Help ::. Dividing the keyboard into two sections
 

Post Reply  Post Oekaki 
 

Posted By Message

LilSpriteX



Registered
  08/05/2003
Points
  28
18th August, 2013 at 18/08/2013 03:06:21 -

A friend and I are trying to make a game for vision-impaired or motility-impaired players. The game uses one button, any key on the keyboard, so single player is easy to code. But we're a bit stumped on multiplayer. We want to have one player use the left side of the keyboard, and the other player use the right side (arrow keys, numpad, etc). Is there a way to test for multiple keys at once, in a single event, or will I need to code each key individually? I noticed Control X lets me test for a value, but I can't seem to test for a range of values.

 
n/a

Riptide



Registered
  26/07/2013 21:07:20
Points
  101
18th August, 2013 at 18/08/2013 11:44:11 -

Hi there.
I think you can do it (but it would take so long to code)

2 Events for two players:

You make an event like

• Pressed A
OR (Logical)
• Pressed B
OR (Logical)
• Pressed C
=> Player 1 movement.
And so on...

And an other event like

• Pressed Left arrow
OR (Logical)
• Pressed Right arrow
OR (logical)
=> Player 2 Movement.


If you want to make an event to test multiple key-presses you can do it like that:

• Only one action when event loops
+ Repeat while the key x is pressed
+ Repeat while the key y is pressed
+ Repeat while the key z is pressed

As i said, It would take years to code it that way, it's just an idea, i think there's an other way to do it.


Why don't you use the built-in controls using the joysticks ?
One joystick for each player
And you can manage the keys for each joystick by editing the default controls
(Go in your game propreties => Go to the "Play" icon And search "Default controls" and press "Edit", obviously)

Even if it's not the thing you wanted to do, i have just that 2 ideas, don't give up ! I think the'rs other ways to do it.

And, btw, Sorry for my english, if i make mistakes it's because i'm french

Edited by Riptide

 
Working on some engines, working for the fun !

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
19th August, 2013 at 19/08/2013 18:16:44 -

There are a couple of extensions that can help with this.
Either way it's going to require you to make a list of keys that you want to include on each side.
You'll have to use an array or delimited string.

The following extensions can get the value of the last key pressed and last key released. You can use this information to determine which keys are currently being pressed:

Control X - Old not recommended.
Key Object - Also old, but works better
Keyboard Object - Newest

Also keep in mind that these extensions aren't compatible with any other runtimes besides the Windows executable, so if you plan to make this a flash application, or anything else you'll have to use Riptide's method.

Both methods are going to require you to make a list of keys that should be detected either way.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click