Answer the question
In order to leave comments, you need to log in
Cocos2d-js, how to read/set pixels on layers or textures?
Hey!
It is necessary to "manually" set the pixels of the layer (sprite), I did not find any bitmaps in the coconut, the cc.texture2d and cc.DrawNode objects do not have methods for reading pixels from the JavaScript API.
It is very necessary to manually pixelate one of the layers in the game.
Give me ideas, please, how to be?
PS In general, the point is that ClippingNode is used for the ptaformer, where instead of texture tiles we put mask tiles that are superimposed on larger tiles. The trouble is that ClippingNode squanders FPS very much on Android devices, rendering to texture does not work with ClippingNode, so the only way I see is to manually fill in pixels in those places where there is a mask. The cc.DrawNode object has a drawDot method, which, in principle, can set a pixel by passing the correct dot radius and color as parameters. But how to read which pixel to set? Those. you need to read the color of the mask pixel by pixel from another node (layer), and take the color from the texture.
Answer the question
In order to leave comments, you need to log in
I want to recommend that you switch to pixi.js and the wonderful phaser and panda engines written on its basis. After I learned these names, my life became better. Now even the guards smile at me on the way to work and the birds sing outside the window even at minus fifty. PIXI.JS is unique!!!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question