JeZxLee Posted July 22, 2017 Share Posted July 22, 2017 Hi, I am starting the playing game screen on Monday... I have an interesting issue now with porting the SDL2/C++ logic core to PixiJSv4/JS: I need to read individual pixel colors in PNG sprites for both the maps and the ghost return home A.I. Look below to understand... Is there a method in PixiJSv4 to read individual pixel colors in PNG sprites? Let me know, thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 22, 2017 Share Posted July 22, 2017 You have to use html5 canvas2d api on that. getImageData() and so on. You can also use something like "renderer.extract.xxxxx" i dont remember, look in the docs. I recommend pure html5 api Quote Link to comment Share on other sites More sharing options...
xerver Posted July 23, 2017 Share Posted July 23, 2017 If you just need to read the pixels of an image, use the canvas 2D APIs. Just create a canvas, draw the image, read with getImageData(). If you need to read pixel values of a rendered scene, use the renderer.plugins.extract.* API since reading pixels is a bit complex in WebGL (by comparison). Quote Link to comment Share on other sites More sharing options...
JeZxLee Posted July 23, 2017 Author Share Posted July 23, 2017 I'll modify the original SDL2/C++ project to dump the maps to a text file - think that would be best... (the maps are final and will not be changed from original PDH3 game) Thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.