1
votes

I have created a phaser 3 project with the width and height set to 1920 x 1080. This has been done within the config of the game.

I am trying to make this fit to any screen and scale correctly. Does anyone have any ideas on how this is achievable?

1

1 Answers

1
votes

You can try something like this in the config. More importantly, the scale in config:

var config = {
  type: Phaser.AUTO,
  scene: {
    preload: preload,
    create: create,
    update: update,
  },
  // Allows Phaser canvas to be responsive to browser sizing
  scale: {
    mode: Phaser.Scale.ENVELOP,
    autoCenter: Phaser.Scale.CENTER_BOTH,
    width: 1920,
    height: 1080,
  },
};

You can find documentation here:

https://rexrainbow.github.io/phaser3-rex-notes/docs/site/scenemanager/