Controllers and players

0 favourites
  • 6 posts
  • Hey all.

    I am wracking my brain trying to figure this out for a multiplayer game:

    I have 4 instances of "robot" out of the 4 players the first person to press "a" I want to become robot 1, the second person will become robot 2 and so on.

    How do make the system know that controller (0 - 3) is players one to 4? I really can't work it out.

    I've got a variable in the robot called 'controller type' and I'm just in am mess of code.

  • Any ideas? Do I need to provide more information?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm going to bump this one last time and then give up haha :)

  • Due to no one else offering support on this one I'll offer what advice I can

    I don't have much experience with controllers but here goes.

    You need to create some way for the computer to know that Robot_A is free. A local variable to say he's waiting for a his controls would work here.

    Next you need a way to be able to say which pad has pressed a button 1st, some global variables might be helpful here.

    When a global variable is equal to a robots local variable then that robot can be assigned that pads control scheme.

    You might need to provide some more information to get a more accurate answer from someone who is more experienced in controllers then me.

    It would be far easier just to assign Robot_A to Pad_0, Robot_B to Pad_1 etc

  • Thanks, I've tried so many different ways, my buddy even told me how he would do it in C and I still can't work it out. He was saying you'd made one player class and then give it a players 1-4 variable, then have the player await input and have it filter out the signals coming in and accept only the assigned controler.

    I was trying to duplicate all these different combinations of controllers and players but he said that I should be able to do it only writing one bit of code for the movement and one bit of code for each controller, not separate code for every single combination.

  • I disagree a little.

    In this sense we do have some alternate solutions. If Roboat_A had a local variable set to 0 (0 meaning waiting for input) then you could set up various controls schemes.

    If Robot_A local variable = 1 then set his control scheme to Pad_0 = 1 (Global variable)

    If Pad_0 = 1

    Robot_A = 1    ----->   Then set Pad_0 group to active

    Its a rather long way around and I'm sure there will be a simpler solution somewhere but that's how I would go about doing it.

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