GamePad Support / Movement Components

Hi @nantas, @pandamicro

Are there any plans to add gamepad support via API to Cocos Creator . I think it would be very beneficial for us developers to have the ability to create games, that use gamepads…Also, having the ability to add Movement Components and applied it to a target node (ex: player ) , and then you can change directions, etc… within the component itself, instead of adding through code ( Keyboard, Touch )…. Hope you understand my explanation…This in effect will increase developing time, and less tedious in adding movement to players via code…God Bless…

Sincerely,

Sunday

1 Like

Hi,

Does anyone know, if this can be done via the current cocos creator api like below:

Enum KEY

dpadLeft Number readOnly

The dpad left key
dpadRight Number readOnly

The dpad right key
dpadUp Number readOnly

The dpad up key
dpadDown Number readOnly

The dpad down key
dpadCenter Number readOnly

The dpad center key

Or should I import as plug-in the gamepad api:

I’m looking to create a 2 player game using 2 gamepads, export to html5.…Anybody has any experience creating 2 players game…? God Bless…

Sincerely,

Sunday

i was able to implement support to my android controller by making changes on Cocos2dxGLSurfaceView.java onKeyDown and onKeyUp, and also TouchesJni.cpp. Both are build\jsb-default\frameworks\cocos2d-x\cocos\platform\android, after you create a build.

Im pretty sure you can even support any controller like this. just make sure to make the events pass from java function onKeyDown, through C++ function Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeKeyEvent, and then through javascript. You can map the index on unused keyboard keys.