How do I use 1 function simultaneously?

0 favourites
  • 2 posts
From the Asset Store
Template for dungeon/maze generation, using wave function collapse
  • If I have a function that gets called when a keyboard key are held down and the same function gets called when another key are held down...

    ...is this possible?

    I use a function that should do things to a player object when I press a key. It's about steering an object with the arrow-keys.

    But I have 2 players, and when Player1 and Player2 steer left at the same time - it does not work. ( yes the Player2 has other keys assigned )

    I guess the function can not be called like that "at the same time" ?

    Each call (for Player1 and Player2) gets different parameters. And the function works fine if only one player steer left or right, but if both steer at the same direction at the same time, it does not.

    I have 2 functions, one for "SteerLeft" and one for "SteerRight"

    I guess I have to do this in a different way somehow. I wonder how the mechanics that are in progress here works when the function get calls at the same time?

    If anyone can explain, I'll give you a HUG!

    ///Soulmachine!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have done some simple experimenting and found that it IS possible to call the same function "simultaneously" and to steer a Player1 and Player2 at the same time using the same function.

    I created a totally clean project and had only the controls and a simple function - it worked.

    then my problem depends on something else - at least I know this now.

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