Hello Guest

Author Topic: Adding effects ontop of animations? Flashing, translucent, etc.  (Read 5724 times)

1337Rooster

  • Newbie
  • *
  • Posts: 9
    • View Profile
Hello,

I'm trying to figure out exactly where this fits into unity and 2d toolkit.

Suppose you want to be able to add effects to sprites, separte from animation. I.e. for every movement animation you have for your character, you might also want to be able to make the sprite flash a certain color. This would be useful to indicate the player has recently taken damage, as done in games like sonic, mario, zelda, etc.

The only way I can think to do this right now is to create an animation for every movement, and also have one for each effect, leading to a combinatorial explosion.

Is there somewhere I can find a list of effects I could apply to animations (Or rather the right APIs to create them?), and if they are part of 2d toolkit or the core Unity? I'm just not sure where the right APIs are for this sort of thing as they don't seem to be covered in the main docs.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Adding effects ontop of animations? Flashing, translucent, etc.
« Reply #1 on: August 17, 2013, 06:28:50 pm »
There aren't API functions to do this, as you'd need to do this with shaders. The provided tk2d shaders tint the sprites, but you can replace the shaders with ones that will highlight instead.
Eg.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,118.0.msg311.html#msg311


1337Rooster

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Adding effects ontop of animations? Flashing, translucent, etc.
« Reply #2 on: August 24, 2013, 08:05:15 pm »
I was kind of wondering why all the tk2d shaders don't have color's parameters, but instead use the color of the tk2dSprite?

It's just a bit confusing to me as to why the Color parameter isn't a part of the shader but is part of the tk2dSprite. Doesn't think make these shaders less compatible with things outside of tk2d? For instance could you use a tk2d shader on something that wasn't a tk2d sprite?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Adding effects ontop of animations? Flashing, translucent, etc.
« Reply #3 on: August 24, 2013, 08:54:49 pm »
Changing the shader parameter on a material will require all sprites using that material to be applied by the same tint. Using the sprite color allows you to have differently tinted sprites using the same material.

You're free to use any shader with tk2d sprites if you want to, and you can use tk2d shaders on any normal objects too.