[Request] - Gamepad ID expression

Discussion and feedback on Construct 2

Post » Fri Nov 28, 2014 3:54 pm

@Tokinsom, I had the same issue as you, and after applying some helpful advice from some forumites, this is how I handle multiple gamepads and/or keyboard input in my game. Everything is assigned dynamically before this, and then to read the controls, I simply loop through each player (the PlayerBlocks family in my case), check their ControllerNumber variable against the gamepad number, and take it from there. In my case, "Gamepad 10" is considered to be the keyboard.

multi-controller.png
You do not have the required permissions to view the files attached to this post.
B
57
S
15
G
11
Posts: 912
Reputation: 12,626

Post » Fri Nov 28, 2014 4:05 pm

Nope. I can't fine the gamepad index in a loop. I absolute the loopindex as the gamepad id then do the poll input request. However I do map index to a controller input slot. Let's just say it's a pain.

I don't know the exact names at the moment
Repeat gamepad.count
-- check for button down then callback function("controller.DOWN", loopindex, gamepad.lastbutton)
-- check for button release then callback function("controller.UP", loopindex, gamepad.lastbutton)
-- check for xAxis !=0 then callback function("controller.axis_x_change", loopindex, gamepad.xaxis )
... repeat for each input type.

and I do that for every input type I need. And it's annoying, because then i'm polling for every possible change every tick rather than just letting the even occur then finding which one it occured on.

@GeometriX
That works too. While I do some more dancing with mine to map the gamepad.id /loopindex count. I prefer controller input agnostic. So the input does not tie immediately to the player. But that's me.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,038

Post » Tue Nov 14, 2017 1:13 am

Subscribing to topic for updates.
B
151
S
75
G
20
Posts: 1,793
Reputation: 22,749

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: DavidCerdeira, zenox98 and 10 guests