Unit Colors

In a game like age of empires, do they have a separate image for each color of a unit.

Example

redSoldier.png

blueSoldier.png

greenSoldier.png

Or do they have like

soldier.png

and then they modify the pixels during runtime to create a soldier image of each color.

If choice 2, how do I do this?

Thanks

[362 byte] By [Nethera] at [2007-11-26 19:33:05]
# 1

this is possible with RGBImageFilter. I haven't done this in a long time, but I do have an example I wrote a few years back (so excuse the aged code)

you can check it out at http://woogley.net/misc/BallBounce/

(just run BallBounce.jar)

it is only using one image (the red ball that you can see in ball.gif), it simply changes the hue.

like I said, it's been a while since I've done it, but just take a peek at the source.

Woogleya at 2007-7-9 22:05:03 > top of Java-index,Other Topics,Java Game Development...
# 2
Thanks for the example program. I think I'm going to stick with creating all my images before runtime just because it is easier. Seems to me like the user is either going to have to wait a little longer to download a bigger file or wait a little longer every time they run the program.
Nethera at 2007-7-9 22:05:03 > top of Java-index,Other Topics,Java Game Development...