jaws icon indicating copy to clipboard operation
jaws copied to clipboard

Gamepad support, multiplayer considerations?

Open zatch opened this issue 10 years ago • 3 comments

Hey there,

Just wondering if you've spent any time working with the Gamepad API, now that it's in live builds of Chrome and Firefox... I whipped up something to add support myself, but it's far from perfect at this point. Xbox 360 support only, but that would be easy enough to change. Feel free to check it out on my fork: https://github.com/zatch/jaws

Criticisms and enhancements appreciated!

-Zatch

zatch avatar Jun 05 '14 04:06 zatch

Hi @zatch.

Great feature :v:

You could create a simple demo?

Bye! :)

brenopolanski avatar Jun 05 '14 11:06 brenopolanski

@brenopolanski I'm honestly not sure if I'm going overkill on the math I'm doing in jaws.gamepadReadJoystick, so I don't feel quite ready to build a formal demo page yet. I'd prefer to actually know what I'm talking about before I write up documentation/notes. ;)

In the meantime, you can check out the work-in-progress game I'm working on with @suicidepills. It has pressure-sensitive joystick support for movement (left analog), as well as for drawing a vector that will eventually represent attacks (right analog).

Game progress as of this moment: http://zandadev.com/zach/hack-n-slash-sprint/gamepad-early-demo/

You can see how I'm implementing the gamepad joysticks at: lines 99-122: http://zandadev.com/zach/hack-n-slash-sprint/gamepad-early-demo/js/entities/player-factory.js lines 67-91: http://zandadev.com/zach/hack-n-slash-sprint/gamepad-early-demo/js/entities/character-factory.js

Let me know if you have any questions! Or, if you're better at physics than I am, if you have any suggestions!

-Zatch

Disclaimer 1: Current game sprites are borrowed from Final Fantasy 4. Disclaimer 2: Chrome is pretty fickle about detecting gamepads... You have to be holding down a button on your gamepad when you refresh the page. Something to do with gamepad signatures...blah blah blah...something else I don't understand.

zatch avatar Jun 05 '14 11:06 zatch

@zatch... I will test your code and the send to you my suggestions.

Bye! :P

brenopolanski avatar Jun 05 '14 17:06 brenopolanski