Linking animation frames to instance variables?

0 favourites
  • 2 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)