Hello, help me please, how to stretch background image on full screen?
I use game.add.image.
Example:
game.add.image(game.world.centerX, game.world.centerY, ‘map’).anchor.set(0.5);
Hello, help me please, how to stretch background image on full screen?
I use game.add.image.
Example:
game.add.image(game.world.centerX, game.world.centerY, ‘map’).anchor.set(0.5);
This should do it
let image = this.add.image(this.cameras.main.width / 2, this.cameras.main.height / 2, 'map')
let scaleX = this.cameras.main.width / image.width
let scaleY = this.cameras.main.height / image.height
let scale = Math.max(scaleX, scaleY)
image.setScale(scale).setScrollFactor(0)
Thanks! I had the same problem, this helped.