Clone array with event

0 favourites
  • 2 posts
From the Asset Store
Publish and Subscribe to events in event sheets and from the scripting interface
  • Hi!

    Is it possible to clone an array using events?

    Why do I need it?

    There might be other solutions that I simply fail to see, but here's what I'm doing:

    -I have an array that stores amounts objects the player has

    -I loop through a second array which checks if those objects are suitable to use and in this loop I reference the first array: for example, if the corresponding position in the first array has more than zero, then I render an object visible using the loop. So if the corresponding position in the first array has the number two, I first render one object visible and subtract one from the corresponding position in the first array. Then I render another copy of the object, until the corresponding position in the first array has become zero.

    The problem is, I don't really want to subtract from the first array permanently, I'm only subtracting for the sake of the loop. That's why I was wondering if there is a way of making a temporary duplicate from the first array just for the sake of the loop?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a quick thought:

    You could try loading the array from json (you can use the array action load with otherArray.AsJSON expression).

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