Tom Atom Posted May 4, 2015 Share Posted May 4, 2015 Hi, yesterday I wrote code, that adds support for 9-patch images into Phaser. New NineImage class is created with new (Phaser 2.3.0) component-like approach (while I am not sure, whether I did everything 100% well). I wrote tutorial about it on my blog: http://sbcgamesdev.blogspot.com/2015/05/phaser-tutorial-adding-9-patch-image.html You can also download it there. As it derives from sprite and uses Phaser components, it can be scaled, rotated, anchored, ... image like this: can be easily used like this: Link to comment Share on other sites More sharing options...
stupot Posted November 25, 2015 Share Posted November 25, 2015 It's worth noting that the Phaser.Canvas.create() parameter list changed (in this commit) and broke Tom's NineImage code, currently it won't work with Phaser 2.4.3 and above. The changed function now requires the object parent to be the 1st parameter, so it's easy to find the few occurances in the NineImage code and add this. You'll know you've hit this problem if your 9patch's are coming out with a width that should be the height and a height of 256. Since this version of NineImage, Tom has generously offered an alternative version (here). Link to comment Share on other sites More sharing options...
Recommended Posts