Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am making a 2d platformer in java using the slick2d engine. I only use 2 colors: black and white. I want to implement a feature were i invert the colors of certain entities. However i can't find a way to do this. Anyone knows of an easy way or function?

share|improve this question
    
Are the entities loaded from file or drawn by in java? Both cases would support Tinting however I unsure if tinting black with white would work :) –  AbstractChaos Aug 8 '12 at 15:49
    
The graphics are loaded from spritesheets. –  Malthe Lange Aug 8 '12 at 15:59
add comment

1 Answer

Try this on white one first, add this Color test = new Color(0f,1f,0f); then in your render method using your sprite sheet do.

spriteSheet.startUse();
test.bind();

//draw sprites

spriteSheet.endUse();

If this works then you could simply have a single sprite sheet (of all white) and color it anyway you wish.

Hope it helps

share|improve this answer
    
I tried using the above on one of my enemies' animation: if(manager.inverted && verticalDir == LEFT){ Color test = new Color(0f, 1f, 0f); moving.getCurrentFrame().startUse(); test.bind(); moving.getCurrentFrame().draw(position.x, position.y); moving.getCurrentFrame().endUse(); } It just stopped my entities from being rendered at all P.S: I can't get the code tags to work on this site –  Malthe Lange Aug 8 '12 at 21:43
    
@MaltheLange could you post your render code? –  AbstractChaos Aug 9 '12 at 9:23
add comment

Your Answer

 
discard

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.