{ESO} Posted October 27, 2013 Share Posted October 27, 2013 Hi,after the changes of the 23 in the crop i can see better performances. Great work!Anyway i've now an issue with this new version. Basically if now i want to give a width and an height to an image cropped, this will resize the main image an not only the crop area as was before. Here the two code example:1.0 before of 23oct (working):// get the full imagevar runnerhead = game.add.sprite(runnerbody.x + 7, game.world.height - runnerbody.height, 'headrunner');// crop the headrunnerhead.crop = new Phaser.Rectangle(runnerImg.selected.x,runnerImg.selected.y,runnerImg.selected.w,runnerImg.selected.h);// resize the headrunnerhead.width = 40;runnerhead.height = 50;runnerhead.body.setSize(40,50);1.1 (not working):// get the full imagevar runnerhead = game.add.sprite(runnerbody.x + 7, game.world.height - runnerbody.height, 'headrunner');// crop the headrunnerhead.cropEnabled = true;runnerhead.crop.x = runnerImg.selected.x;runnerhead.crop.y = runnerImg.selected.y;runnerhead.crop.width = runnerImg.selected.w;runnerhead.crop.height = runnerImg.selected.h;// resize the headrunnerhead.width = 40;runnerhead.height = 50;runnerhead.body.setSize(40,50);Do you have some solution? Thanks Link to comment Share on other sites More sharing options...
rich Posted October 27, 2013 Share Posted October 27, 2013 Can you upload the image you're using please, will help me debug. Link to comment Share on other sites More sharing options...
{ESO} Posted October 28, 2013 Author Share Posted October 28, 2013 Hi Rich,you can find the simple example here In here the sizes of the 2 head suppost to be the same (40x50) but looks very different Thank you Link to comment Share on other sites More sharing options...
{ESO} Posted October 31, 2013 Author Share Posted October 31, 2013 Ehi @rich,did you have the time for look this? Thanks Link to comment Share on other sites More sharing options...
{ESO} Posted November 3, 2013 Author Share Posted November 3, 2013 I found a workaround.... You can set the width and the height of a cropped sprite in this way (example for 40x50)runnerhead.width = (runnerhead.width * 40) / runnerhead.crop.width;runnerhead.height = (runnerhead.height * 50) / runnerhead.crop.height; Link to comment Share on other sites More sharing options...
Recommended Posts