Clone array with event

Get help using Construct 2

Post » Tue Jul 15, 2014 12:10 am

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?
B
9
S
1
Posts: 97
Reputation: 715

Post » Thu Jul 24, 2014 8:03 am

Just a quick thought:
You could try loading the array from json (you can use the array action load with otherArray.AsJSON expression).
B
4
Posts: 3
Reputation: 209


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests