SOLVED-I can get gamepad(0) Y axis but not gamepad(1) Y axis

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hello,

    I'm making a multiplayer top-down shooter game, played with gamepads.

    I can get player 1 moving with left stick, aiming with right stick, dodging with left button, shooting with right trigger, all on gamepad(0).

    To add a player 2, I cloned every assets and cloned the controls to fit player 2. Now my player 2 can move and dodge correctly, but he can't aim. I can't get the gamepad 1 Y axis.

    When looking into the capx, do you have any ideas why?

    Thanks a lot for your help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're using the wrong notation. Take a look at this line:

    player2crosshair.X+Gamepad(1).Axis(0,2)*dt*20[/code:3v9088rx]
    Placing a number n in parenthesis after the object name tells Construct you want to access properties from the nth instance of that object -- you can do this for all object types, and has nothing to do with the Gamepad index.  You're trying to access the Gamepad instance with index 1, which doesn't exist since there's only one instance of the Gamepad object.  The Gamepad index is specified in the first parameter of the "Axis" expression.  So what you actually want is this:
    
    [code:3v9088rx]player2crosshair.X+Gamepad.Axis(1,2)*dt*20[/code:3v9088rx]
    And similar things with the rest of your expressions.
    
    EDIT: Some links for reference:
    [url=https://www.scirra.com/manual/78/expressions]Expressions - See "Object expressions"[/url]
    [url=https://www.scirra.com/manual/143/gamepad]Gamepad manual entry[/url]
  • Thanks a lot! I also had some typo errors.. now everything is working! And thanks again for the useful info.

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