How do I

0 favourites
  • 4 posts
  • Oh, Constructtwonians a question burns deep within my loins!

    I'm trying to figure out what the best way is to facilitate different controlling options for different players:

    Player1 on keyboard1 (wasd, gyh)

    Player2 on keyboard2 (Arrows, shft, ret, ctrl)

    Player3 on Controller1 (controller 1....)

    Player4 on Controller2 (A banana.......... eh, I mean controller 2)

    So, how can i set this up to easily switch the different sets of controls to different players in the option screen?

    I liked how Spelunky HD did it, but perhaps there are other, better ways?

    As always, I thank you!

  • If you're using objects in a family or of the same object type you can just set up an instance variable 0-3 which determines the control method. Then when you make the events, make them so they are segmented into the different control methods, and pick the instance of that object which has the instance variable that corresponds to the control. Ok I'll show you with pictures because this is making my head hurt.


    Then under those groups add the rest of the controls.

    Edit: Then of course in your options screen you have events which stop the user choosing the same controls for multiple players. When you want to change the control method, even during runtime, you just change the instance variable and it will instantly take effect.

  • Ah yes, this is what I thought too. However, what happens when player 1 wants to play on keyboard2 and player 2 wants to play with the xbox controller? I could write out all four control schemes out for all four players. I am looking for a more time-efficient way to do this.

    Neat explanation though!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure what you mean. It would work with that too. What this does is just applies whatever your control does, to whatever instance has that control type enabled. If you do it that way then it will work for anything at all. It's not writing out the control scheme for each player, just for each control scheme. Furthermore you can add more objects to it without much hassle using a family.

    Edit: the reason it would work is because it picks the instance which has the control method.

    Edited Edit: Here's an example in a capx.


    Also it doesn't matter if you have an object for each player, all that would mean is that you would use a family for all these events instead of my "players" platformer. I used only one because it's simpler, but if you were to use more than one, a family with the same events would work too. If you can't use families then you should use an instance variable determining player id which changes the animations anyway.

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