How do I replace Global variables?

  • Hello!

    I don't know if it is possible at all. but is there a way to replace a global variable?

    Like e.g. I got some lines of events with a global variable in it, which is bases on 2 different players.

    Now I want to copy and paste that line to make the 2nd player but that global variable is quite often in it, so I had to replace it manually every time.

    Is there a way to do it or maybe just a faster way to make it manually? I solved this problem by making player-specific sprites which are not implemented in the game itself but serve as a variable safe or something like an array. Later, I can copy+paste the events/movements or player 1 to player 2 and just replace player 1 stat object with the player 2 stat object.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For the objects you could do with instances rather than different object types.

    As for the global variable, unfortunately, a global is global to the whole project, so no easy way than replace it manually indeed.

    The advantage of instances is also you can handle instance variables with them.

    And finally, with instances, you only need to apply your movement code once, all that changes is the condition for picking.

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