Gamepad Issue

Get help using Construct 2

Post » Sun Jul 28, 2013 10:21 am

Hi guys,


     So Im making a local multiplayer game and Im looking to simplify the events. It will have up to 4 player, and you play with 4 gamepads. Every sprite being controlled by the player is exactly the same. I was wondering if there is a way to give the sprite a variable, name it "Player" and give it a number 1,2,3,4... And have it set up so that that variable is used to detect input from its matching controller. Basically, streamlining the control events by only having to write them once, instead of once for each gamepad.

Thanks for any help.
B
36
S
5
Posts: 156
Reputation: 3,310

Post » Sun Jul 28, 2013 10:38 am

If I didn't make that clear enough, I basically want to make my events go like.. if any gamepad button A is pressed.. if Playersprite.Player is equal to Gamepad.. Simulate jump. So if its the second controller, only player two would jump.. and so on.
B
36
S
5
Posts: 156
Reputation: 3,310

Post » Sun Jul 28, 2013 2:02 pm

that's exactly what i was wondering too :D
I haven't found a good solution yet but if you want we could exchance our .capx to see how eachother dealt with the controllers. I'd be interesting to see i guess.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Sun Jul 28, 2013 2:22 pm

Well , each gamepad has a different id , eh ?

I never played around with the gamepad object , so this is just ontop of my head

Give each player an id variable that corresponds to the id of the gamepad you use to control the player with

And the

On gamepad key pressed
If player.id = gamepad.id
Do action
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Sun Jul 28, 2013 11:46 pm

Hmmm, let me try that. I tried a variation of that, but had no luck.
B
36
S
5
Posts: 156
Reputation: 3,310

Post » Sun Jul 28, 2013 11:56 pm

The Controller Id just sends a string listing make and model, not an actual number. Does anyone know how to get the number?
B
36
S
5
Posts: 156
Reputation: 3,310

Post » Mon Jul 29, 2013 12:34 am

@philx Sorry, its a full game project. Im not really comfortable sharing it. No offense. :)
B
36
S
5
Posts: 156
Reputation: 3,310

Post » Tue Jul 30, 2013 12:29 pm

allright @mELTINGsKYsTUDIO this is understandable. So I'll just send you mine.
It was my second attempt, so im sure there are loads of improvements but maybie it will help you in some point.
https://docs.google.com/file/d/0B7m-eoWIKsSMa0dvQTdOOW9ldzA/edit?usp=sharing

I'll try what Whiteclaws said as soon as i'm back from hollidays and if i get to a acceptable solution, i'll share it in this thread.

Edit: PS: if somebody is interested in the Joystick PNG's, send me a messagephilx2013-07-30 12:31:14
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Tue Aug 20, 2013 9:04 am

@mELTINGsKYsTUDIO have you found a acceptable solution yet?
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Tue Aug 20, 2013 9:48 pm

[QUOTE=Whiteclaws] Well , each gamepad has a different id , eh ?

I never played around with the gamepad object , so this is just ontop of my head

Give each player an id variable that corresponds to the id of the gamepad you use to control the player with

And the

On gamepad key pressed
If player.id = gamepad.id
Do action[/QUOTE]

are we talking about the pre-set UID or the manually settable instance variables?
i'm working on something to get this correct atm but i dont really come to a working result.

EDIT: @Whiteclaws i'm sorry, stupid question. it's not instance variables. but how can you set the same ID for the gamepad1 and the player1?philx2013-08-20 21:51:43
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Next

Return to How do I....?

Who is online

Users browsing this forum: plinkie, R0J0hound, SERG 04 and 1 guest