[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.

You do not have the required permissions to view the files attached to this post.
Posts: 912
Reputation: 12,606

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.

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.
Posts: 2,455
Reputation: 15,018


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 27 guests