NokFrt Posted December 13, 2017 Share Posted December 13, 2017 I have a BitmapData object. This object is used as a texture for several Images (Phaser.Image). Every image is on a different position in the world and every image should show only a specified part of the BitmapData. I thought I can achieve that by settings a different cropRect for each image, but that doesn't work. If I do this: img1.cropRect.set(0, 0, 100, 100); img1.updateCrop(); img2.cropRect.set(200, 0, 100, 100); img2.updateCrop(); then the img1 shows exactly the same thing as the img2 and completely ignores its own cropRect. The BitmapData object is dynamically updated every step so I can't generate different texture for each image. I also tried using frames but the results is still the same: let frame1 = new Phaser.Frame(0, 0, 0, 100, 100, "topLeft"); let frame2 = new Phaser.Frame(1, 100, 0, 100, 100, "topRight"); bmd.frameData.addFrame(frame1); bmd.frameData.addFrame(frame1); img1.setFrame(frame1); img2.setFrame(frame2); Link to comment Share on other sites More sharing options...
NokFrt Posted December 13, 2017 Author Share Posted December 13, 2017 I've just solved it!!! I use new PIXI.Texture for every image and this PIXI.Texture use the same baseTexture as the BitmapData object. Now I can change cropCrect in every image and it works. Link to comment Share on other sites More sharing options...
samme Posted December 13, 2017 Share Posted December 13, 2017 Try crop(…), possibly with copy=true. Link to comment Share on other sites More sharing options...
Recommended Posts