dcsan Posted April 20, 2015 Share Posted April 20, 2015 I'm a bit new to phaser so forgive me if these are obvious: It seems sprite tween resize is all relative, eg 2Xbased on the size of the original bitmap it was based on is there a way to scale a sprite to fill the screen exactly? I can only think of - finding the original size of the sprite (not sure what the API for that is)- find screensize- screensize / bitmapsize = target scale factor I got that working but wonder if i'm missing something. onDown: () -> # tweener = game.add.tween(@sprite).to( {x:400, y:400},1000 ) BITMAP_SIZE = 10 # original bitmap newSize = { x: @state.game.width / BITMAP_SIZE y: @state.game.height / BITMAP_SIZE } # newSize = {x:10, y: 10} console.log("onDown", newSize) tweener = game.add.tween(@sprite.scale). to(newSize, 100, Phaser.Easing.Linear.None, true, 0, 0, true ) Link to comment Share on other sites More sharing options...
rich Posted April 20, 2015 Share Posted April 20, 2015 game.add.tween(sprite).to( { width: game.width, height: game.height }, 1000, "Linear", true); Link to comment Share on other sites More sharing options...
Recommended Posts