TreeLoys Posted January 9, 2016 Share Posted January 9, 2016 I load atlasgame.load.atlas('menu-border', 'img/rpanel.png', 'img/rpanel.json')in img/rpanel.json{"frames": [{ "filename": "ng-top", "frame": {"x":137,"y":0,"w":133,"h":27}, "rotated": false, "trimmed": true, "spriteSourceSize": {"x":0,"y":0,"w":133,"h":27}, "sourceSize": {"w":133,"h":27}}],"meta": { "app": "TreeTeamsSpriteAtlasEditor", "version": "1", "image": "rpanel.png", "format": "RGBA8888", "size": {"w":270,"h":84}, "scale": "1"}}I create bimapDatavar bg_menu = game.make.bitmapData(600, 400);I need copy "ng-top" frame in rigth-top angle $bg_menu pseudo:bg_menu.copyRect('menu-border', 'ng-top', 567, 0);bg_menu.addToWorld();but it does not work MadOwl 1 Link to comment Share on other sites More sharing options...
TreeLoys Posted January 9, 2016 Author Share Posted January 9, 2016 After 5 hours of digging source Phaser, I created a function that satisfied me. I would like to see this feature in the new version of the Phaser. function copyRectArea(bmd, keyArea, keyFrame, x, y, alpha, blendMode, roundPx){ var frame = game.cache.getFrameData(keyArea).getFrameByName(keyFrame); var area = new Phaser.Rectangle(frame.x, frame.y, frame.width, frame.height); bmd.copyRect(keyArea, area, x, y, alpha, blendMode, roundPx);}Using:var bg_menu = game.make.bitmapData(600, 400);var area = new Phaser.Rectangle(137, 0, 133, 27);copyRectArea(bg_menu, 'menu-border', 'ng-top', 167, 0);bg_menu.addToWorld(); MadOwl 1 Link to comment Share on other sites More sharing options...
Recommended Posts