Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bennett

Pages: [1]
1
Ok. But in the file I sent you, I'm also finding it impossible to change between animations using script.

I'm calling myTransform.GetComponent(tk2dAnimatedSprite).Play("animationName") but nothing happens. What am I doing wrong?

2
Sure.

3
I got it working by making a new SpriteAnimation object. I guess the old one got corrupted.

4
I had already done that. The issue is that it doesn't update the collider at runtime.

And now I have an even worse issue, which is that I can't change the animation at all at runtime :-/

Not sure if it's a bug - I don't think I changed anything!

I'm calling it as follows (My animations are named "0", "1", "2", etc., and all the animated sprites are stored in an array called "_sprites"):
Code: [Select]
for (var i : int = 0;i < _sprites.length; i++) {
     var anim:int = Random.Range(0,4);
     _sprites[i].GetComponent(tk2dAnimatedSprite).Play( anim.ToString() );
}

5
I'm generating prefab animated sprites at runTime, and selecting an animation after instantiating them. But they all default to the collider set for frame 0. How can I get it to update the colliders as the frames change?

Pages: [1]