Linking animation frames to instance variables?

Get help using Construct 2

Post » Sun Sep 02, 2012 9:50 am

Hello!

I'm trying to trigger animation frame changes via instance variables, so that animation frames of an object can be switched while other depictions of that same object [with different animation frames] are visible, and unaffected.

Is this possible? Or is there another way, besides importing each frame of the animation as a separate sprite?

Thank you!teahousemoon2012-09-02 09:51:31
B
28
S
6
G
5
Posts: 248
Reputation: 5,463

Post » Sun Sep 02, 2012 10:19 am

selecting the correct uid

^I believe this answers my question...

(quoted from above source)

Newt:

"Actually I think the reason its not there, is because uid's aren't assigned until runtime.

Also there's no good way to guess the uid, because the naming method is shared between all objects.

What you can do is create the objects and place the uid into a instance variable, and then pick by that.

Or, you can pick by the sprites index "pick "nth"". This is unique to named object types, so all instances of the same object are easier to pick. Just remember the first is 0, second 1, etc. Then in expressions you can use sprite(index) to reference a specific instance, sprite(0).x would be the first created sprites x."
----------------------------------------------------------------------------------------------------------
More information here:

Scirra Manual

and

Understanding UIDs and IIDs

Sorry, just didn't know what to look for.teahousemoon2012-09-02 10:24:34
B
28
S
6
G
5
Posts: 248
Reputation: 5,463


Return to How do I....?

Who is online

Users browsing this forum: Evanetot and 17 guests