November 2019
Beginner
436 pages
8h 52m
English
Just like the background, the original image for our spaceship may be either too big or too small. In my case, it is tiny, and I need to scale it a bit. Let's see how we can do that:
// Create ship ship = this.add.sprite(100, 100, 'ship'); ship.setScale(4, 4);
const game = new Phaser.Game(config); let ship; function create() { // Create background const image = this.add.image( this.cameras.main.width / 2, this.cameras.main.height / 2, 'background' ); let scaleX = this.cameras.main.width / image.width; let scaleY = this.cameras.main.height ...Read now
Unlock full access