Array help.

Get help using Construct 2

Post » Sat Sep 15, 2012 8:41 pm

Let's say I have an array called "NewArray".

If I want to step through it one step each time the player presses Z. How would I go about doing this?

Just tried:

On X Pressed
Object - Pick instance with UID NewArray.Back
-Pop back on X axis



No success. I've been trying to do this a couple of ways. Right now I'm thinking I would have to do it like this:

On X Pressed
Object - Pick instance with UID NewArray.Back(-GlobalAxisVariable)
-Pop back on X axis
-Add 1 to GlobalAxisVariable
B
4
Posts: 46
Reputation: 617

Post » Sat Sep 15, 2012 8:58 pm

[quote]On X Pressed
Object - Pick instance with UID NewArray.Back
-Pop back on X axis
[/quote]
This should work, are you setting up the array with object UIDs?
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Sat Sep 15, 2012 9:09 pm

My current scripting for setting up new objects into the array.

B
4
Posts: 46
Reputation: 617

Post » Sat Sep 15, 2012 10:01 pm

In the array properties is the size 0x1x1. By default the size is 10x1x1.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Sat Sep 15, 2012 10:21 pm

Ohhh!!!

I should be looking in the Y axis then?
How can I arrange this in the X axis instead?

What I want to do is to insert each object in the X axia and step through it that way. Seems much more lika the way I would do it in LUA (I wish Construct had LUA support like MMF2).
B
4
Posts: 46
Reputation: 617

Post » Mon Sep 17, 2012 3:21 pm

Just set the width property of the array to 0 and it should work.
If the width is 10, as it is by default, you will have to press X 11 times before you pick any object you added by pressing Z.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Tue Sep 18, 2012 8:09 pm

Right. Got it working after reading up a bit on the array section.
Now I have a different problem I for the life of me can't figure out.

I'd like to have an arrow above the oldest stone object. Once you destroy the oldest one I want it to move to next.

At first I thought it would be easy.

I ended up with something like this:


Not working at all. I can see the object I want to position not moving.
B
4
Posts: 46
Reputation: 617

Post » Tue Sep 18, 2012 8:58 pm

Try and add a "pick all PlayerStone" to the middle of your second event.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Tue Sep 18, 2012 9:08 pm

That sort of worked. Problem is that the arrow is "lagging" behind. It seems to always be one action behind.

Let's say I have no stones out. I place one stone. Nothing happens. I place another stone, the arrow moves to the first stone.
B
4
Posts: 46
Reputation: 617

Post » Wed Sep 19, 2012 12:53 am

Well... I got it working.
For some reason changing the On Created event to an every Tick event seemed to work.

Would have preferred to keep it as On Created, just for the sake of me not wanting to have stuff I don't need refreshed on every tick to actually get refreshed all the time.
B
4
Posts: 46
Reputation: 617

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 35 guests