Scale game

Hi,

finally I found some time to play with Phaser 3. Coming from Phaser 2, I could scale the world to fit my sprites into the screen.
Assume I have an image which is 3000×1500 and the screen resolution is 1920×980, how can I get my image scaled down to the screen resolution where the width is controlled by the height?

I know the image is far too big, but I need scaling somehow as I want to develop for different machines (Desktop and mobile (grr, I’m facing you again, iOS)).

Can I scale scenes instead of the world (Phaser 2)?

Hey,

You should take a look at the ScaleManager

Here’s also a good resize example that can help you achieve this.

When I use that scale property, it says:

Object literal may only specify known properties, and ‘scale’ does not exist in type ‘GameConfig’.

The game config looks like this:

const config: GameConfig = {
    type: Phaser.AUTO,
    parent: "canvas",
    width: 960,
    height: 540,
    scene: [
        Preloader,
        Main,
    ],
    scale: {
        parent: 'yourgamediv',
        mode: Phaser.Scale.FIT,
        width: 800,
        height: 600
    }


};

and I don’t have Phaser.Scale, only Phaser.ScaleModes.

I’m using Phaser 3.16.2 through npm.

Solved: Just downloaded the definitions file from here.