How do I code for 4player Couch Co-op W/Controller?

0 favourites
  • 4 posts
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • Couple questions... Planning on a steam Greenlight release and doing a 4 player co-op game platforming game. We'd do couch co-op first, release as early access, then add online Multiplayer support. Risk of Rain is inspiring the idea behind the game, so pretend I'm just remaking that in C2 lol. My questions are:

    • How do you program for a multiple controllers/keyboards, and so each controller only affects that person's character? (speaking strictly for couch co-op). Are there any tutorials I could follow for this?
    • Is online multiplayer feasible for C2 yet? Last I checked over a year ago it still wasn't very well done.

    -Am I stepping into a mess if I create couch co-op first, then try to add multiplayer? Or should I plan multi from the beginning, or can I add that on last without much issue?

    -If I buy a template off of the store, I can't add to it my code right? I remember you couldn't just import other projects into eachother

    Thanks for the answers and suggestions!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • bump fast board

  • When adding a gamepad event, the first value entry is the numbered controller the action pertains too. I would look into Windows and how the Xinput system works for joysticks and gamepads.

    In terms of code there's a variety of ways to go about it from there, using a loopindex, families, or my approach has been just finishing the controls for one user, copying and pasting ALL the events and just going from there. The later is more time consuming and seems like a less intelligent way to go about it, however if you keep your subgroups well-organized it can be the most stable, and fairly intuitive.

  • What I tried to do, is create a "Players" Family, and assign all platform movement code to the family (running, jumping, climbing). Then I'd only have to program each character's individual attack 1-4. Lets say I have 8 different characters, I would have each of those in the "Players" family. The Players family has a variable called ControllerID, which is assigned to a Controller ID when a player clicks on a character at character select.

    What I can't figure out is how to get that controller to only work for the player that has it's ID assigned to them. Any ideas? You can tell I'm stuck with a brain fart, below is the farthest my logic got haha.

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