Game Development Community

Glow and Blink Effect

by Stanley D Chatman · in Torque Game Builder · 08/24/2006 (12:50 pm) · 1 replies

I would like to have the effect of when the mouse is over a sprite, the sprite will glow in like some reddish color or the sprite will blink. Short of creating individual sprites for this how can I acheive this dynamically. I was thinking about cloning the sprite in question and making it slightly larger when the mouse is over to give a outlined glow effect. Does anyone else have any ideas about doing something like this?

#1
08/24/2006 (2:27 pm)
Have you considered using 'setBlendColour' on the sprite? You could use this to tint the sprite a certain color or adjust its overall transparency. If you write a schedule loop that slowly increases/decreases the blend values you can have it pulse the color or blink transparency too.

However this just effects the sprite itself, so if you wanted a 'halo' or outline around the sprite, you'd have to go one step further. If all your sprites are of similar shape, you could make one generic 'glow' sprite and overlay that on top of the existing sprites, but if the sprites are different enough and/or you want very shape-conforming line or halo, you'll have to create a new sprite (or frame) for each.

Your trick to duplicate the sprite and increase its size a bit is a nice creative and perfectly acceptable solution if it looks ok with the shape/coloration of your existing sprites. There's also the possibility that you could combine this approach with different source/destination blending modes to achieve something workable. I'd suggest playing with Alex Rice's awesome blend mode demo here for some insipration.