Page 1 of 1

Change colour of a sprite

PostPosted: Tue May 29, 2012 8:39 pm
by bjadams
I have a white sprite, called MySprite.

I want to change it's colour to RED.

Searching around I found out that I need to do MySprite.RGB(255,0,0) however being a total newbie I cannot find my way where I need to input this in the Events.

any links or faqs where I might find some more help?

thanks a lot.

Re: Change colour of a sprite

PostPosted: Tue May 29, 2012 9:14 pm
by jimand
I didn't know you could change a sprite's color that way. I've done it with the text object, changing the font color, but not with sprites. My approach would be to create white and red versions of the sprite,load them as different frames of animation for the sprite, set animation speed to zero, and then pick the animation frames as desired.jimand2012-05-29 21:15:51

Re: Change colour of a sprite

PostPosted: Tue May 29, 2012 9:21 pm
by bjadams
it will be impossible to load multiple coloured versions because i will have 30 sprites and each sprite can have 20 different colour combinations.

there must be some simple way to set the RGB values and colorize a sprite.

Re: Change colour of a sprite

PostPosted: Tue May 29, 2012 10:25 pm
by R0J0hound
You can't directly apply a color filter on a sprite. There is a plugin that applies a color filter to a sprite's image.

You can mix two sprites with the "source atop" effect:
http://dl.dropbox.com/u/5426011/examples11/colorize.capx

Another method would be to just have a silhouette sprite of a solid color always on top of the sprite you want to color.

Re: Change colour of a sprite

PostPosted: Tue May 29, 2012 10:27 pm
by sqiddster
@R0J0hound, I never knew that! Clever.

Re: Change colour of a sprite

PostPosted: Wed May 30, 2012 7:50 am
by Ize
@R0J0hound this is pretty smart... i shall steal it :D

Re: Change colour of a sprite

PostPosted: Wed May 30, 2012 8:03 am
by bjadams
What is the name of the plugin that applies a color filter to a sprite's image?

Thanks.

Re: Change colour of a sprite

PostPosted: Sat Nov 16, 2013 7:11 pm
by Dseipp
Hi, does anyone have an example of changing a sprite colour when clicking on a button?

I've searched the forums and this post is the closest I found

cheers
Dave