Changing the player controller of a behaviour during game

This forum is currently in read-only mode.
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi all

    Here's my problem.

    I have an object using the basic plateform behaviour in construct.

    By default it's Player 1 controlling it.

    I want it to be controlled by Player 2 when needed.

    But i don't find any ways to change this.

    I've controls for player 1 and player 2 set. But i cannot switch the "owner" to player 2

    (i've thought about put 2 controller one for player 1 , one for player 2, but i will need to duplicate a lot of things to do this, its not very elegant)

    If you have a elegant solution to handle this kind of thing (2D fight game, you chose your character but mirror match are forbidden)

    I ll be glad to here it

    Thanks all

  • The simplest way to do this would be to simply give your player sprite two platform behaviours, set them up for player 1 and 2, and a private variable to keep track of which player is allowed control, then change the variable whenever you need.

    If the variable is "1" you deactivate platform behaviour for player 2 and vice versa.

    Here's a cap, should be fairly self-explanatory.

    http://www.box.net/shared/y9rvdedlzv

  • Thanks for your reply inkbot.

    I know this could work. But i wish i could do it another way.

    Because with 2 plateform behaviour i need to duplicate all the

    is_walking

    is_jumping etc ... events

    Because the test is done only for first behaviour

    i've already test it. it works but with second player no animation is played.

    Thanks anyway it seems there is no easy / lazy solution :p

    PS : couldn't open your cap, dont know why, i've the latest version of construct

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's another way to do it with only one platform behavior. You can override controls with the "set control state" action of the MouseKeyboard object.

    + System: Always (every tick)

    -> MouseKeyboard: Set control "Move Left" of player 1 to 0

    + MouseKeyboard: Key A is down

    -> MouseKeyboard: Set control "Move Left" of player 1 to 1

    Here's an example cap.

    http://dl.dropbox.com/u/5426011/examples2/controlswitch.cap

    made with 0.99.94

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