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 - bcullis

Pages: [1]
1
You were exactly right, I switched to PlayFromFrame(frozenFrame) and the error went away!

For posterity, this is what it looked like on the "freezing" side:

if(spriteAnimator.CurrentClip.frames[spriteAnimator.CurrentFrame].eventInfo.Equals("HIT_FREEZE"))
{
    _freezeFrame = spriteAnimator.CurrentClip.frames[spriteAnimator.CurrentFrame].eventInt;
    spriteAnimator.SetFrame(_freezeFrame);
    spriteAnimator.Pause();
}

And the original "unfreeze" call was just a spriteAnimator.Resume().  Changing it to spriteAnimator.PlayFromFrame(_freezeFrame) resolved the error.

Thanks!!

2
Here's the setup:
In an animation clip, I've added a trigger on frame 1 with an int value indicating a further frame number.  This further frame is the "freeze" face of a critter in our game that's just been hit with a freeze attack.  In sequence, if they're hit with this attack, I
1) check for event trigger during play
2) if found, use its int value to set the new frame of animation
3) call Pause() to halt the animation in that frame.

Which works fine, it lets me define the exact pose in a "react to hit" animation that each critter type gets frozen in.  However, when they thaw back out, I want to just resume their animation.  When I call Resume(), I get the following:

IndexOutOfRangeException: Array index is out of range.
tk2dSpriteAnimator.ProcessEvents (Int32 start, Int32 last, Int32 direction) (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs:709)
tk2dSpriteAnimator.UpdateAnimation (Single deltaTime) (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs:658)
tk2dSpriteAnimator.LateUpdate () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteAnimator.cs:725)

So I assume that the manual frame jump is what's causing the animator to step off the end of the frame array.  Any thoughts on how I could fix this?

My initial attempt just put the actual freeze trigger on the frame I wanted to use, but that ended up getting skipped unreliably between critters as their animations can be cut short based on their behavior state machine.  Frame 0 seems guaranteed to play before anything potentially switches them up, thus I stuck the trigger there with the "look ahead" value.

3
Support / Correctly accessing sprite's mesh vertices?
« on: October 07, 2013, 04:23:10 pm »
My goal is to apply a shear operation to a sprite, basically taking the top two verts and moving them over and down a little (i.e. from square to parallelogram).  I've almost achieved the same effect with simple localScale modifications (minus the sideways move), but for more flexibility and other ideas being tossed around, what's the correct (if any) way to access the positional data of the sprite's mesh vertices?  Do I directly modify sprite.positions?  I tried that and got some incredibly weird artifacts instead of expected behavior, so I'm not sure if that's the right path to be going down.

Thanks!  TK2D has been awesome to work with!

Pages: [1]