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

Pages: [1]
1
Support / Re: How does tk2dBaseSprite.color behave?
« on: June 18, 2013, 07:09:13 pm »
Sweet - thank you so much. For other people's reference, this is how my reference image looks when adjusted for the fact that tk2dBaseSprite.color behaves like the Multiply blend mode in photoshop:



Just gotta be kind of careful since multiply is a darken blend mode, but I think this will serve my purposes. Thanks!

2
Support / How does tk2dBaseSprite.color behave?
« on: June 18, 2013, 06:38:08 pm »
Hey there,

In our game we have a need to "colorize" sprites like this:



Setting tk2dBaseSprite.color definitely does...well, something. Can you explain the intended behavior of this property?

Thanks!

3
Support / Re: Change sprite collection for an animation library?
« on: June 17, 2013, 06:13:52 am »
Thanks for the help...took me a while, but here's the code I came up with (using the 1.x library). I'd be curious to hear any feedback or optimizations.

Code: [Select]
    void SwitchSpriteCollection(tk2dAnimatedSprite animatedSprite, tk2dSpriteCollectionData spriteCollectionData)
    {
        // Set up the new sprite.
        tk2dAnimatedSprite newAnimatedSprite = animatedSprite.gameObject.AddComponent<tk2dAnimatedSprite>();
        newAnimatedSprite.anim = newAnimatedSprite.gameObject.AddComponent<tk2dSpriteAnimation>();
        newAnimatedSprite.anim.clips = new tk2dSpriteAnimationClip[animatedSprite.anim.clips.Length];
        newAnimatedSprite.Collection = spriteCollectionData;

        // Copy the clips from the original sprite animation.
        for (int i = 0; i < animatedSprite.anim.clips.Length; i++)
        {
            // Initialize the new clip.
            newAnimatedSprite.anim.clips[i] = new tk2dSpriteAnimationClip();

            // Store references to both clips.
            tk2dSpriteAnimationClip oldClip = animatedSprite.anim.clips[i];
            tk2dSpriteAnimationClip newClip = newAnimatedSprite.anim.clips[i];

            // Copy the old clip.
            newAnimatedSprite.anim.clips[i].CopyFrom(oldClip);

            for (int j = 0; j < oldClip.frames.Length; j++)
            {
                tk2dSpriteAnimationFrame oldFrame = oldClip.frames[j];
                tk2dSpriteAnimationFrame newFrame = newClip.frames[j];

                // Get the ID of the equivalent sprite in the new collection.
                string spriteFrameName = oldFrame.spriteCollection.spriteDefinitions[oldFrame.spriteId].name;
                int spriteFrameId = spriteCollectionData.GetSpriteIdByName(spriteFrameName);

                // Set up the information for the new (copied) frame.
                newFrame.spriteCollection = spriteCollectionData;
                newFrame.spriteId = spriteFrameId;
            }
        }

        // Destroy the animation we just replaced
        Destroy(animatedSprite);
    }

4
Support / Change sprite collection for an animation library?
« on: June 10, 2013, 05:14:56 am »
I'm creating a 2D RPG and I have made sprite collections for each piece of armor in the game. Each armor has the same animations for walk, idle, etc. and each frame is named exactly the same way for every piece of armor.

Is there a way to change the sprite collection used by the animation at runtime? Or, if not, is there some way I can duplicate the animation library and just change the sprite collection it uses in the editor? I haven't found a method for either of these.

Pages: [1]