Two Instances of Array

Get help using Construct 2

Post » Sun Mar 17, 2013 7:55 pm

Hello,
I'm trying from a long time to create two instance of Array to let them to be of different size and contains different values.

I need, for example, two Array_Test.
The first has 3 values (1,2,3)
The second has 5 values (5,6,7,8,9).

How I can do this VIA CODE?

I'm becoming crazy!
Someone can help me, please?
B
10
S
4
G
4
Posts: 42
Reputation: 3,091

Post » Sun Mar 17, 2013 9:10 pm

Hi,

why not use 2 arrays ?
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Mar 17, 2013 9:39 pm

You can:

1) Create two different array objects in your project
2) If your data is 1d or 2d, you can use 3d array
3) Create separate instances of same array object and refer to them via UID you store during creation, or IID: array(0).at(0,0) or array(1).at(0,0)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon Mar 18, 2013 8:21 am

@spongehammer
It's only because I want to learn how to use instances of objects!

@vee41
I've used the 3) point you suggested on my own, it's the simplest method I think.


Thanks!
B
10
S
4
G
4
Posts: 42
Reputation: 3,091

Post » Mon Mar 18, 2013 4:51 pm

Another option to organize array instances is to tie an array to another object (invisible sprite) via a container. This particular method is useful in that it allows your arrays to have a "physical location", for example, multiple grid systems on a layout that you can mouse over. It allows you to pick the arrays any way you would normally pick a sprite object, which people are most familiar with.
Mistakes were made.
B
37
S
17
G
67
Posts: 1,041
Reputation: 38,211

Post » Mon Mar 18, 2013 7:03 pm

@oosyrag
Ok, I'll give a look at this, too.

Thanks!
B
10
S
4
G
4
Posts: 42
Reputation: 3,091


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 32 guests