Dual Stick joypad use in glb?

Previous topic - Next topic

MrPlow

Hi Guys

My latest game for IGMC competition requires a dual stick or stick and pad use for shooting while moving...

Anyone have any success with a similar thing?

thks!
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

CatchOut uses it with GameInput API (I'm have not uploaded that to google play, but using it for ouya).

Just remember let user remap the right stick on android (using KEY() 256-320 or Android.Scancode(), if you want float) in that case it's using a different mapping than that Google recommend.

Left stick don't require remapping, but make sure to uses dpad as well left stick for checking for best support.

Alternative ABYX buttons can also been used as they was a stick.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrPlow

Cool - thanks SF!

Currently I just need it to work on desktop...Would I need to update my android extras for GameInput commands?
Or is it just a gbas file update?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

spacefractal

#3
GameInput API is shared with iOS, Android, Pandora and Windows platforms.

On Windows you can use Keyboard as well a xbox controller. For WASD keyboard auto remapping on Windows, you can do this in your startup code:
Code (glbasic) Select

CostumeRemapping._RIGHTSTICK_LEFT=30
CostumeRemapping._RIGHTSTICK_RIGHT=32
CostumeRemapping._RIGHTSTICK_UP=17
CostumeRemapping._RIGHTSTICK_DOWN=31


On Android its a more complicered, due you need doing the user remapping you self and send to the same variables (only RightStick is required). Im do have done various functions for this task in the Remapping class. See functions and how to use them there.

In the main code, allways use this in a LOOP:

Code (glbasic) Select

GameInput.SetPresaure(0); GameInput.update()[/b]


If you set SetPresaure(1), then GameInput sends a analoge float between 0 and 1, which also include action buttons on iOS.

And For checking Right stick (example) right in your game, the command is GameInput.RightStick_Right().

As alternative control for your game, you can checking A button (GameInput.ActionButton("A")), so the hero just fire in that direction the hero face. That would works if right stick for some reasons fails, and the game would still been playable.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

erico

I never did a twin shooter as of yet, but last time I checked joy commands withi my logitech dual stick, it all worked fine at least on PC.

MrPlow

Thanks guys!

Erico did you use GetJoyx(0) and Getjoyx(1) for the dual controller?!

Think I have to order one now :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

Exactly, it worked fine at the time.
I have a logitech dual action here. I think space did get a more advanced version of this a few months ago, I think I recall he said it also worked fine.

MrPlow

I have other usb controllers and they act weird with joystate and sometimes the make the game run very slow and sluggish using getjoy commands

Is it just down the usb controller used?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

That is strange, are they well calibrated on system to boot?
Mine is an usb cable joy, works fine.

I think I did upload a joytest code for caanoo on the snipets long time ago and that reports joystates and do work with PC, so it may be a good test for you to give a go.
Let me find where that code is and you can give a shot with your current joys.
Again, don´t forget to calibrate them first on your system.

hang on...

erico

Ok, check this post:
http://www.glbasic.com/forum/index.php?topic=7197.msg59066#msg59066

The first post has a pc version link, give that a try on your joys.
Left pad and joy should move the screen around, the right joy should rotate and zoom it, check the numbers so they reach the range they have too, if they don´t, it is probably a calibration problem.
Cheers!

edit: my snipet had only 1 download, nobody loves me :'(... :D :D :D

MrPlow

Great, thanks Erico!

Getting good player feedback from those that tried the new game....I mat add a split screen mode if the joystick options work out. :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

erico

Nice.
It will work out. :good: