Changing colour of sprite "in game"

Blitz3D Forums/Blitz3D Beginners Area/Changing colour of sprite "in game"

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.

You just need to do something like this (pseudocode):

For n = 1 to 10 ; 10 frames
SetBuffer ImageBuffer(image,n)
LockBuffer
For x = 1 to imagewidth
For y = 1 to imageheight
c = ReadPixelFast x,y
If c = shirtcolor Then WritePixelFast x,y,newcolor
Next
Next
UnlockBuffer
Next
SetBuffer BackBuffer()

If you want to make a copy first, just do a CopyImage ahead of time and run this routine on the copy instead.

Edit: Yeah, you do this before your main loop.