|
Change sprite color |
armond
Member #8,282
January 2007
|
Hi guys! I'm not sure what it is exactly I need. I only know that I want to change the color of my already loaded sprite. If you're wondering why, here's the reason... I have a bullet sprite. Let's say, when the player shoots that bullet it's colored blue(the default color from the bitmap including some shading). But when the enemy shoots that bullet I want it colored red(and the shading to follow). I want this to happen in the draw() method of my sprite. How can I achieve this? Thanks! |
GullRaDriel
Member #3,861
September 2003
|
Just add some sort of percentage thing. "Code is like shit - it only smells if it is not yours" |
Jonatan Hedborg
Member #4,886
July 2004
|
I should point out that you would be wise to make a copy of the bullet-bitmap and change the color of that (so you don't use that function once per enemy bullet per frame). Another way to do it is to read in each pixel's color value, convert it to HSV, rotate the H part a certain amount (or simply set it to a specific value), convert it back to RGB and write it to the target bitmap.
|
Johan Halmén
Member #1,550
September 2001
|
Just prerender it with a decent graphic editor. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest. |
gnolam
Member #2,030
March 2002
|
-- |
Onewing
Member #6,152
August 2005
|
Quote: draw_lit_sprite() Seconded, this should be all you need for what you want to do. ------------ |
|