Archived

This topic is now archived and is closed to further replies.

Changing colours

This topic is 5506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

right, if i want to make a game, where i have or more teams, and i want to use the same graphic for each team, yet i wanted them diferent colours, how could i do this without creating a seperate picture for each one? say i make the guy, and i clouor the parts i want changed "Pink", then loaded that one .bmp. like in the game starcraft..

Share this post


Link to post
Share on other sites
there are a few obvious ways to go about this:

1)Say your "character" is a circle with a predefined size and a color stripe indicating their "team" which is in the bitmap as 255,0,255 (aka magic pink) You could have outline bitmaps which are blue,red,etc and then overlay blit the character with transparency onto the other bitmap.

I''d vote against this one because #2 is much faster, and uses the same amount of disk space.

2) The obvious solution is to simply create a certain number of bitmaps, which is fastest but uses the most disk space.

3) Go through the surface pixel by pixel (there is code to do such things in the SDL examples) and if the current pixel is your select color, replace it with the "team" color. This saves disk space, but would take some extra code and loading time.

(If you need additional help I have an example somewhere, email james@conceptofzero.net and I''ll try to dig it up)

Share this post


Link to post
Share on other sites