Jump to content

GameConfig


Ad4m
 Share

Recommended Posts

Hi all,

I'm wondering where can I find the game-configuration-object's description? I was browsing the docs here and, even if I don't know if it does have what I am looking for, when I clicked in the GameConfig param link, I got an 404 Error. So now I don't know where to look for.

Can you help me understand the game config object?

Link to comment
Share on other sites

Game Config is pretty need, it really helps you to organize your code.

 

Back in Phaser 2 when you instantiate Phaser you write something like this:

let game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });

First time I saw this I wasn't sure what are these parameters for. And these are just basic parameters that Phaser constructor can accept...Which is not really good quality good overall.

 

Now Phaser 3 simplifies this by adding a object, called gameObject. It looks like this:

let GameConfig = {
        type: Phaser.CANVAS,
        width: 800,
        height: 600,
        scene: [Boot, Game],
        backgroundColor: "#dbcf8b",
    };

The order doesn't matter, some parameters are optional so you don't have to write them all. After setting up everything, just pass the object to contructor

let game = new Phaser(GameConfig);

So back to your question. Just make the object yourself.

Link to comment
Share on other sites

Thanks all for replying.

Yes @michebn what I want i can find it at https://photonstorm.github.io/phaser3-docs/boot_Config.js.html#line-54 as you can see there's almost no description there and you have nothing here https://photonstorm.github.io/phaser3-docs/Phaser.Boot.Config.html .

I was looking for something like @samme provide at https://photonstorm.github.io/phaser-ce/global.html#GameConfig but Phaser 3 not phaser-ce.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...