jdnichollsc Posted October 28, 2015 Share Posted October 28, 2015 Hi guys! Is possible to resize a bitmapdata using scaleMode RESIZE? Any example please? Any help is greatly appreciated! davis1148 1 Link to comment Share on other sites More sharing options...
jmp909 Posted October 28, 2015 Share Posted October 28, 2015 not sure what you need to do with the RESIZE scaleMode, but this is how to resize an image to a new bitmaphttp://phaser.io/sandbox/DoAbtYim/play could you elaborate on what you need? function create() { var map = game.make.sprite(0,0,'map') var w = map.width var h = map.height console.log(w,h) // => 1500,843 var ratio = w/h // let's make a new map image, 300 high var newW = 300*ratio var newH = 300 // create a bitmap data at our new size and draw the map to it // this draw() function resizes the source to the new dimensions var bmp = game.add.bitmapData(newW, newH) bmp.draw(map,0,0,newW, newH) // show the bitmap data var sprite = game.add.sprite(0,0, bmp) sprite.anchor.set(0.5,0.5) sprite.x=400 sprite.y=300} Link to comment Share on other sites More sharing options...
jdnichollsc Posted November 1, 2015 Author Share Posted November 1, 2015 But if you need to change the width of bitmapdata when the game is resized? Link to comment Share on other sites More sharing options...
Recommended Posts