Hello Guest

Author Topic: Change a sprite color, but instead of tinting the pixels, solid paint them.  (Read 6547 times)

marcosramos

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
I'm not quite sure if it's a TK2D question, or more of a general question, sorry if it's general.

I want my sprite to be painted red to display a character taking damage, but i don't want his forms to be visible like when it happens when I simply change the color through tk2dsprite and he gets tinted red. I want his form to become all Red.

I can do something like that changing the shader in runtime, but the color won't change If there is a tk2dSprite script in it, even if I change the tk2dsprite color or directly via material.renderer.color.

Even so, i'd rather have another solution other than changing the shader because i know zero about shaders, but if it can't be done, then I will go that way, no worries.

Thanks!




unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Change a sprite color, but instead of tinting the pixels, solid paint them.
« Reply #1 on: September 19, 2013, 11:54:13 pm »
This shader is additive instead of multiplicative. It won't COMPLETELY replace the color, but should be a better result than what you get now.
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,391.msg1708.html#msg1708

marcosramos

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Change a sprite color, but instead of tinting the pixels, solid paint them.
« Reply #2 on: September 20, 2013, 12:03:17 am »
Yes, I decided to go for the shader solution.

The GUI/Text Shader from unity default shaders does exactly what I was trying to do. It even allows alpha, so it's perfect, but thanks for the fast Answer!

 :D

tarcisiotm

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
This GUI/Text Shader tip is gold! Exactly what I needed too!

Thanks for the tip, marcosramos!