Multiple Control Methods

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • My brain is breaking, this is quite hard to explain. Here's what I'm trying to do:

    I have 4 players, I have keyboard inputs for two players and xbox controller inputs for the other two. Alternatively all 4 players can use 4 different xbox controllers.

    All my player movements are done with variables; so "when left key is down" - "set 'turn left' to true" - "when left key is not down" - "set 'turn left' to false".

    I am really struggling trying to cater for any combination of player control methods, so for example, player 1 can use the Keyboard and Player 2 can use the xbox controller.

    If the players only have 1 xbox controller, that means that player 2 will need to use Controller index '0'. What I've done is say 'If player 1 control method = keys and player 2 = controller' - 'use controller 0' - I then write all the controls for this combination.

    With 4 players though, say if player 1 and 2 use keyboard and player 3 and 4 use controllers, that means that players 3 and 4 need to use controller index 0 and 1. So that would mean I'd need to write out all that code for that eventuality too.

    So what do I do? Do I write code for every possible combination or is there a more efficient way of doing it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could pre set 4 different inputs for controllers and 4 for keyboard (8 total) and then create a menu of some sort to choose which player will use keyboard or controller manually.

    Just a quick idea.

  • You'll need to setup each controller inputs for a invisible player object, all the rest are sprite animations over it. Pick the nearest sprites of the player to change his animations...

    I did a little game using this concept, with mouse and keyboard.

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