Changing sprite colours during runtime.

Blitz3D Forums/Blitz3D Beginners Area/Changing sprite colours during runtime.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Probably the easiest way is to have the 3 distinct colours primary colours that aren't used elsewhere on the strip, Magenta (255,0,255), Green (0,255,0) and Yellow (255,255,0) for example. Then simply make a copy of the original graphic, loop through the pixels using readpixelfast and if you find any of those 3 colours replace with the colour you want using a writepixelfast.

If however, you've got some shading in there then I would suggest doing the base image as full colour with grey scales on all the bits you need to colour. Then have 3 seperate 1 bit images for the 3 coloured areas, run through the colour area bitmaps giving the grey of the base image the required hue.