Retrieve gamepad number

0 favourites
  • 8 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Is there a expression to retrieve a specific gamepad's gamepad number?

    When the player presses start on the controller, I want to assign the gamepad number to a variable.

  • At first it's a gamepad, but then it's a console controller 0_o

  • Yeah, I use the terms interchangeably. I've always called them controllers, but I've had to switch with C2's "gamepad"

  • NOt that I know of. As it is gamepad have to be explicitly polled for information rather than triggered.

    Personally I feel the gamepad should be

    On gpad Left

    -- if gpad = 0 then do player 1 stuff

    as it is now

    On gpad 0 Left

    -- do player 1 stuff

    this is really annoying as it requires duplicating all the controller events. This can be easily done by putting all controller events into a single group say "Player 1".

    Then copy/paste Player 1 to new versions. then go through each event and reference controller index 0 to 1, and repeat for every controller :(

    alternativly you can do what I did.

    Repeat 4 Times

    -- Is gpad loopindex Left then Function.Call("Pad.Left", loopindex)

    -- Is gpad loopoinex A Then Function.Call("Pad.A", loopindex)

    I do a little more than that to handle Press, Release and analog state. but that's the jist of handling X number of controllers with the same code base.

    The disadvantage is that the controller is constantly polled every tick rather triggering on an input event :(

  • Thanks jayderyu. I'm surprised there isn't a gamepad number expression. It would really simplify things and prevent redundant code

    :On Gamepad Start pressed:

    create object Spite

    Set Sprite variable "gamePadNum" to gamepad.number

    which would allow you do do some many things easily

    :ForEach Sprite

    ::Gamepad(Sprite.gamePadNum) Button "A" is down

    Sprite Spawn Another Object "Bullet"

  • It's a little late to change my code now, but I wonder if it might be done with functions to do away with redundancy.

    Still, if you have 3 gamepads connected with numbers 00,01,02 and gamepad 01 is unplugged, a lot of "Repeat GamePad.GamepadCount times" conditions will break. I'm not sure if gamepad numbers are reassigned when a gamepad's USB is yanked out.

    Anywho, I'll let you know if I find anything. Maybe someone else has an idea and will chime in as well!

  • I have a problem with dual gamepad configuration.

    I've used the single gamepad and works fine, but when I add more event for dual gamepad, The Game won't detect any user input.

    I'm using this kind of gamepad.

    image.en.09635.com/2012-8/11/USB-Dual-Shock-Twin-Gamepad-STK-8032-426.jpg

    can anybody help me fix this?.

    more detail :

    scirra.com/forum/topic79041_post468244.html

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Dazky

    You're problem is unique to ours; if you want any help, I'd recommend starting your own thread instead of changing the topic of this one. <img src="smileys/smiley1.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)