Creating "instance arrays"

Get help using Construct 2

Post » Fri Sep 26, 2014 12:28 pm

Hi,

I'm trying to setup a small routing simulation in Construct 2 which will in a casual (not truly like the way it works in reality) simulate the the way internet routing works. The user is able to create networks with nodes/routers. Each router object will need a routing table where for example net addresses and cost values will be stored.

So what I would need is to create arrays for each instance of the router object. Of course it would be possible to create one really huge multi-dimensional array where all routing tables will be stored. Though this will not be a "pretty" solution and it would not represent what it looks like in reality. So I'm wondering if there is any way you can programatically create array which you tie to an instance by for example giving it the instance UID name?
B
8
S
3
G
2
Posts: 45
Reputation: 2,193

Post » Fri Sep 26, 2014 1:58 pm

Create the Router object as a Container, with an Array object in it. The array object will be spawned for you when you spawn the Router object. If you need to you can associate the array and router objects somehow, like with router UID or something.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Sep 26, 2014 2:04 pm

Using a container there is no need to associate UIDs whatsoever. Picking any object in a container also picks all other objects in the same one.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Fri Sep 26, 2014 2:29 pm

Magistross wrote:Using a container there is no need to associate UIDs whatsoever. Picking any object in a container also picks all other objects in the same one.


True, which is why I said, if he needs to. There should probably be no need.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Sep 26, 2014 2:41 pm

Thank you codah! Should work just fine :) Haven't worked much with containers earlier though so didn't think about that. Thanks!
B
8
S
3
G
2
Posts: 45
Reputation: 2,193

Post » Fri Sep 26, 2014 11:58 pm

Yeah it's pretty handy in the right circumstances.

Btw I'll be interested to see your simulation
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests