Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Sprite.crop question


bubamara
 Share

Recommended Posts

Hi,

 

when I have sprite created from frame and apply crop on it, I would expect, that only portion of actual frame will be cropped

var mainMenu = _game.add.sprite(0, 0 , 'atlas');mainMenu.frameName = 'mainMenu.png';mainMenu.cropEnabled = true;mainMenu.crop = new Phaser.Rectangle(10,10,100,100);

Instead of that, result is texture area cropped from whole atlas. Is this intentional?

 

Thanks

Link to comment
Share on other sites

  • 5 weeks later...

I noticed the same problem with spritesheets. The whole spritesheet will be cropped instead of the currently visible frame. My guess is that spritesheets are internally cropped to show the individual frames. So cropping spritesheets with more than one frame will lead to conflicts and result in unexpected behaviour.

Link to comment
Share on other sites

  • 10 months later...

Hey, I've been skipping this problem by using separate images for any texture I would need to crop, but now I would like to crop an Image that is part of a TextureAtlas.

 

Is there a way to do this with the built in Phaser functionality? It seems, just like hackenstein said, that the crop function will be applied to the whole atlas instead of the image frame.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...