Discord
Login
Community
DARK THEME

Is it possible to change the color of a sprite?

Self explanatory; is there any way I could make a sprite in greyscale, then use code or whatever else to change the color?

https://microstudio.dev/i/JimB007/spritefunctions2 / I think you need use this library

Take a look at this example by Gilles. I think it's what you want. https://microstudio.dev/i/gilles/colorize/

(You don't need to create the buffer image every frame like Gilles does there. If you do that for many sprites every frame it can drop performance.

At a glance, Jim's functions seem to actually alter the pixels of the sprites, which is overkill for this (and probably slower). All you really need is to draw the sprite and a colored rectangle over the sprite with some kind of blending, which is a simple and fast operation.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community