🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

This should be an easy one...

Started by
0 comments, last by Potsticker 24 years, 5 months ago
Ok, I''m wondering how to blit with different colors on the sprite/graphic to represent the owner of that graphic... So for example. Say there is a helicopter. It would have certain zones on it that are color coded that should upon drawing to the screen be filled in with the correct player color. Say the original graphic has gray on a spot. And when it blits for one player, its blue, and the other its red. Now, I can think of a couple of ways of doing this, but there might be an easy - or fast way so I want to ask. Here are my ideas. 1) Would be to upon loading the graphic, split it into n other surfaces depending on the number of players and set the ''blank'' color to the appropriate player color. 2) would be have one copy of the graphic, and have rectangles the same size as the other graphics, that are filled with the player''s color. First blit one graphic, and then blit the player color box over it, using the color destination key to fill it in with the player color instead. Now, I see 1 as being a serious memory hog. If for every graphic, and player (which there will only be 2 in this game I''m building now, but I want to keep things flexible for the future) there needs a totally seperate copy. That could lead to megs of extra graphics. And 2 I see as being performance intensive. If for every blit. There needs to be an extra on on top of it. Of course, this could theoratically be optimized to blit as small a rectangle as the region that needs to be colored, and not be the same size as the full graphic. So I''m hoping, and guessing there is an easier way. I''m slightly new to this stuff, but I''m getting there. Thanks in advance.
Advertisement
Eye believe your method #2 is what Age of Empires and most other RTSs do.

If you''re worried about the performance hit, you could always just keep one graphic on disk, and then merge the graphic and the "coloring" onto one surface at level load or something.



Mason McCuskey
Spin Studios - home of Quaternion, 2000 GDC Indie Games Fest Finalist!
www.spin-studios.com
Founder, Cuttlefish Industries
The Cuttlefish Engine lets anyone develop great games for iPad, iPhone, Android, WP7, the web, and more!

This topic is closed to new replies.

Advertisement