Change animation on sprite.UID in foreach

0 favourites
  • 3 posts
From the Asset Store
Act on your instances, get/set their properties and variables only thanks to their UID. No more picking trouble! Plugin
  • Hi

    Can anyone tell me, why I can't change the animation on a sprite.UID in a foreach-loop?

    For each sprite order by sprite.UID ascending

    If sprite.UID = 1 then

    sprite.animation = "Something"

    text.text = "This is written"

    The sprite animation doesn't change, but the text is written.. Why?

  • My guess is that if the text worked then the animation change worked but you have code elsewhere that overrides the animation displayed. for example, you have if sprite.UID=1 set anim, but elsewhere you could have the sprite animation set to be idle if its a player that isn't moving or something similar. A possible issue is also a typo with the animation name.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know why I needed someone else to point that out...

    • but you were right - it was another foreach loop that somehow ran simultaneously, even though it was below in the hieraki...

    It works now, thanks..

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