rcpinto Posted April 3, 2017 Share Posted April 3, 2017 Hi, I need to replace the colors of a sprite during the game. More precisely, I need to swap specific colors with others (e.g., swap blue with red). I know that there is a method in BitmapData that does exactly what I need (replaceRGB). But I need to apply it to a sprite. Is it possible? Maybe if I could access the sprite's bitmapdata, I could do that. I know it is possible to replace colors using shaders, but I want to know if it is possible without shaders first. Thanks! Link to comment Share on other sites More sharing options...
spinnerbox Posted April 3, 2017 Share Posted April 3, 2017 https://phaser.io/examples/v2/category/bitmapdata Link to comment Share on other sites More sharing options...
samme Posted April 3, 2017 Share Posted April 3, 2017 examples/v2/bitmapdata/process-pixels-1 examples/v2/bitmapdata/process-pixels-2 examples/v2/bitmapdata/process-pixels-3 Link to comment Share on other sites More sharing options...
rcpinto Posted April 3, 2017 Author Share Posted April 3, 2017 Thanks guys, but all examples in these pages assume you have access to bitmapdata independently of a sprite (at most, the sprite is created from bitmapdata, then, of course, you have the original bmd). Can I assume then that you can't extract the bmd from a sprite, and this is indeed the only way? (to create the sprite from bmd and keep the bmd) Link to comment Share on other sites More sharing options...
samme Posted April 3, 2017 Share Posted April 3, 2017 examples/v2/bitmapdata/copy-bitmapdata Link to comment Share on other sites More sharing options...
Recommended Posts