2D Toolkit Forum

2D Toolkit => Support => Topic started by: iamagiantnerd on January 07, 2014, 03:09:28 am

Title: Advice on how to accomplish an effect on a tk2d sprite
Post by: iamagiantnerd on January 07, 2014, 03:09:28 am
I have a bunch of monster sprites in my game.  I'd like to be able to apply an "ice block" effect.  I mocked something up in gimp to show what I'd like to do:

Before effect applied:
(http://wwflgames.com/wp-content/uploads/2014/01/Untitled.png)

After effect applied:
(http://wwflgames.com/wp-content/uploads/2014/01/iceblockrat.png)

I could imagine doing this by creating an image dynamically by reading the pixels of the original and manipulating them, but I would think there might be a better way.  Shaders?  I'd appreciate any ideas you folks might have.

Thanks!
Title: Re: Advice on how to accomplish an effect on a tk2d sprite
Post by: unikronsoftware on January 07, 2014, 10:48:20 am
Not the easiest thing to do with shaders. You will need additional information in the alpha channel to be able to perform the outline - one tip is to use 2 thresholds in the alpha, say 0.5 for the outline and 1 for full transparent. When drawing the normal sprite without the outline, it simply uses 0.5 as full transparent.