Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to make a sprite darker or lighter in AndEngine? I dont want to use the alpha thing. Nor I want to loose the texture/design of the image.

share|improve this question
I assume you've see the forum post for this?:… And this one:… – Byte56 Jul 31 '12 at 16:46

One way in 2D Android to do darken or perhaps even to make it lighter is to use the lighting color filters:

Paint myPaint =  new Paint(Paint.ANTI_ALIAS_FLAG);
myPaint.setColorFilter(new LightingColorFilter(Color.rgb(120, 176, 209),0)); 

public LightingColorFilter (int mul, int add) Since: API Level 1 Create a color filter that multiplies the RGB channels by one color, and then adds a second color, pinning the result for each component to [0..255]. The alpha components of the mul and add arguments are ignored.

However, this can a bit diminish the color detail on the sprite.

share|improve this answer
I am using AndEngine. These options are not available there/ – Jawad Amjad Aug 1 '12 at 6:17
Can you alter the texure and then swap it in the openGL object in AndEngine? I don't know AndEngine but if it is using OpenGL then there should be an OpenGL function which sets the luminosity (GL_LUMINANCE) and other parameters of the object. – Lumis Aug 1 '12 at 21:18
yes it is using OpenGl. Let me find if I can set the luminosity of the object. – Jawad Amjad Aug 3 '12 at 4:18

For my opinion you have to use setColor method of the sprite to make it darker and lighter. To make darker sprite you have to use

sprite.setColor(180f / 255f, 180f / 255f, 180f / 255f);

To make lighter sprite again you have to use

sprite.setColor(1f, 1f, 1f);
share|improve this answer
Ok im giving it a try lets see what happens. – Jawad Amjad Aug 3 '12 at 4:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.