Populate an object instance animation frame with an array

Get help using Construct 2

Post » Tue Apr 12, 2016 3:44 pm

I would like to populate all instances of my "gamePiece Animation Initial frame" Property from an array. The array holds 5 possible color frames 0 - 4. The gamePiece has also 5 frames in its animation.

So far I am able to update the "gamePiece" object Initial frame but all instances are always the same color dependent upon the first element in the array. The loop is running through the entire array.

Image
B
6
S
1
Posts: 9
Reputation: 426

Post » Tue Apr 12, 2016 4:11 pm

Works perfect. It just all happens in less then 1 tick.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Apr 12, 2016 4:25 pm

If I correctly understood..you don't need a loop...

LoadArray = ["0", "1", "2","3",0","4"];

On "setupLayout".....set gamePiece animation frame to int(LoadArray.At(gamePiece.IID))
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Apr 12, 2016 4:30 pm

The problem is the array values are something like: 10 2 1 0 1 1 2 2 1 1 0 1 2 0 1

All of the instances are just getting changed to the last value in the loop. Not changing each instance to a value corresponding to the place in the array. :|
B
6
S
1
Posts: 9
Reputation: 426

Post » Tue Apr 12, 2016 4:34 pm

Korbaach, brilliant. That did the trick. I made it way too complicated. Thanks for the help
B
6
S
1
Posts: 9
Reputation: 426


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests