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

Just started using Construct 2? Post your questions here

Post » Fri Feb 27, 2015 1:41 pm

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.
You do not have the required permissions to view the files attached to this post.
Last edited by Flodcp on Sun Mar 01, 2015 2:30 pm, edited 1 time in total.
B
6
S
2
G
1
Posts: 34
Reputation: 595

Post » Sat Feb 28, 2015 12:04 am

You're using the wrong notation. Take a look at this line:

Code: Select all
player2crosshair.X+Gamepad(1).Axis(0,2)*dt*20

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: Select all
player2crosshair.X+Gamepad.Axis(1,2)*dt*20

And similar things with the rest of your expressions.

EDIT: Some links for reference:
Expressions - See "Object expressions"
Gamepad manual entry
Moderator
B
111
S
41
G
20
Posts: 1,586
Reputation: 19,046

Post » Sun Mar 01, 2015 2:30 pm

Thanks a lot! I also had some typo errors.. now everything is working! And thanks again for the useful info. :)
B
6
S
2
G
1
Posts: 34
Reputation: 595


Return to Beginner's Questions

Who is online

Users browsing this forum: KittenKatja, PixelByPixel and 0 guests