0 Favourites

[SOLVED] How do I use the keyboard only for one instance

  • Hello guys,

    Lately I have been trying to make a bgame using gamepads, but I would love to keep the keyboard available for "player1".

    The thing is, I spawn my 4 players using the same object but spawning a difference instance, with a variable instance "ID" growing (0-1-2-3).

    Then when I use the keyboard, I specify, "pick the player with player.id=0" and simulate the 8 direction. so that's basicly :

    keyboard -> when left arrow is down

    player -> pick instance with player.id=0 --> simulate 8 direction pressing left

    But when I do that, I launch the game, and all my players instance are moving with the keyboard, at the exact same time.

    Would you happen to know what could cause this ? I can't seem to find the answer... verifyed the id etc, all seems correct !

    Thanks a lot,

    Mael

  • 8Direction behaviour is enabled for all your instances, that is why you move all objects at once. You should set it disabled by default and enable it only for the instance you want to move. You don't have to pick the instance by ID then.

  • Hey Backend, thanks for the answer but I need the behavior to be active for all instance, since they move thanks to the gamepads. Or do I have to enable them each time ?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I am not really sure what you want to achieve but in order to move only one instance you need to:

    • enable this behaviour only for one instance

    OR

    • set "Default controls" (8Direction property) to "No", and then simulate controls by picking the instance as you shown in your first post here
  • Hey backend,

    Thanks a lot, this solved my issue (- set "Default controls" (8Direction property) to "No").

    All the instance was using the arrow, when I only wanted one.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,139
karshinkoff's avatar
karshinkoff
Unread hot topic
132 10,996
Burvey's avatar
Burvey
Unread hot topic
90 77,102
leonhard's avatar
leonhard