[Solved] How do I create multiple instances of an array?

Just started using Construct 2? Post your questions here

Post » Sat Oct 29, 2016 3:45 pm

Hello all,

I have three objects that spawn enemies. I want to store the enemies in an array. The array will be 3D (Level, wave, enemy type).

The spawner objects will look into the array and depending on the current level and wave, they'll spawn enemies specific to that level/wave combination.

I want the three objects to use the same function to spawn enemies. I thought if I could create three copies of the array and have an instance variable to differentiate each array from the other, I could use the same function to spawn enemies (because the array will have the same name but the instance variable will have a different number).

Is this possible? I tried dragging the array to the layout to create a copy but that didn't work.

Thanks.
Last edited by Taweel on Sun Oct 30, 2016 12:13 am, edited 1 time in total.
B
14
S
3
Posts: 29
Reputation: 870

Post » Sat Oct 29, 2016 3:53 pm

You can create the array like any other object, using System:Create object. You can also place an array in a Container, for each spawning object.
ImageImageImage
B
71
S
21
G
231
Posts: 3,695
Reputation: 129,366

Post » Sun Oct 30, 2016 12:12 am

Thank you very much BlackHornet. Works perfectly.
B
14
S
3
Posts: 29
Reputation: 870


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests