Sign in to follow this  
Ad4m

GameConfig

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?

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.