lumoludo Posted August 31, 2016 Share Posted August 31, 2016 Hey guys. I feel like I must be missing something really simple here, but I cannot get the bitmapData::getPixel() function to return anything other than a black color (0, 0, 0, 0). I made an example here (you'll need to open the console to see what I'm talking about):http://phaser.io/sandbox/nMqGYpij I've also tried the getPixelRGB and getFirstPixel, but they both also only return 0, 0, 0, 0. The pixel I'm polling in the example is certainly not black though. Any pointers you could give would be greatly appreciated. Link to comment Share on other sites More sharing options...
rich Posted August 31, 2016 Share Posted August 31, 2016 From the docs: /** * Get the color of a specific pixel in the context into a color object. * If you have drawn anything to the BitmapData since it was created you must call BitmapData.update to refresh the array buffer, * otherwise this may return out of date color values, or worse - throw a run-time error as it tries to access an array element that doesn't exist. lumoludo 1 Link to comment Share on other sites More sharing options...
lumoludo Posted September 1, 2016 Author Share Posted September 1, 2016 Thanks, Rich. I knew I was doing something dumb. I was calling update() in my full project, but not until after I tried to modify it one additional time, causing it to fail the first time. That, combined with a logic error I just found, was causing my issue. Link to comment Share on other sites More sharing options...
Recommended Posts