Pick a variable name based on loopindex?

Get help using Construct 2

Post » Sat Jan 28, 2017 2:51 pm

Can you post a CAPX example? It's still not clear what you are doing/wanting.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sat Jan 28, 2017 3:20 pm

blackhornet wrote:Can you post a CAPX example? It's still not clear what you are doing/wanting.

https://www.dropbox.com/s/r0erae2dpy2sh ... .capx?dl=0 I was suggested to try and use local variables instead of an array, so it's temporarily set up for that with the other ton of variables switched out, if this fails, I'll wire it up to an array instead. I also need to figure out how to pick a different instance for each loop from the families references in the actions for the debug objects.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sat Jan 28, 2017 3:43 pm

You're going to have to tell me what I'm looking at here. There's a lot there.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sat Jan 28, 2017 3:51 pm

blackhornet wrote:You're going to have to tell me what I'm looking at here. There's a lot there.

I've improved it, or so I think: https://www.dropbox.com/s/r0erae2dpy2sh ... .capx?dl=0 If you check the Trace1 group, I've got local variables that adjust according to the direction the player is aiming, and each loop for the 5 different tracers resets and reuses it. I've picked each of the debug objects (the star, end, normal (hit) and line families) based on the loop index. It seems to work okay except one tracer in wanging off to the top, maybe it's cause of the 0-index or something?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sat Jan 28, 2017 3:54 pm

blackhornet wrote:You're going to have to tell me what I'm looking at here. There's a lot there.

One more edit, it was the scope I've fixed, I just reordered the tracer via a subevent: https://www.dropbox.com/s/r0erae2dpy2sh ... .capx?dl=0
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sat Jan 28, 2017 4:20 pm

Why are there 5 clones of everything? I think that's your first problem.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sat Jan 28, 2017 4:55 pm

5 clones why? waste of cpu processing time
B
250
S
39
G
15
Posts: 1,953
Reputation: 40,623

Post » Sat Jan 28, 2017 4:57 pm

blackhornet wrote:Why are there 5 clones of everything? I think that's your first problem.

Well, there's 5 different rays to find 5 different rays of hit points, but I've tidied the code down to using one set of events based on loopindexes.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Sat Jan 28, 2017 5:03 pm

But think about it. You started with one object. You clone that 5 times, and then use a Family to bundle those together as if they are one object type again. You've just made your life so much harder.

My suggestion is to just have one of everything, you create five instances, giving each an ID, from 0 to 4. Now you can pick any of those by the imagepoint #. This simplifies things greatly.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sat Jan 28, 2017 5:11 pm

blackhornet wrote:But think about it. You started with one object. You clone that 5 times, and then use a Family to bundle those together as if they are one object type again. You've just made your life so much harder.

My suggestion is to just have one of everything, you create five instances, giving each an ID, from 0 to 4. Now you can pick any of those by the imagepoint #. This simplifies things greatly.

Ahh yeah, I see what you mean, well those are just debug objects, the actual variables are being used for the tracer start and end points, and it works now with picking families, so I guess it's all solved! :D
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests