TrinityCore

Problem with canvas dimension - Phaser v 3.8

Recommended Posts

Hi Guys!

I have a problem when i create a new "Phaser.Game".

The problem is that when i run the game, this is using other dimension that i haven't spesified in the code. ¿any solution?

 

The code is very simple:

this.PhaserGame = new Phaser.Game(1200, 650, Phaser.AUTO, "canvas", null, false, true, Phaser.Physics.ARCADE);

Thanks to all for your time.

Share this post


Link to post
Share on other sites

Let me guess, your canvas is 1024x768?

That is the default for Phaser if you just call "new Phaser.Game()".

The headline says v3.8 but you are not using any gameConfig to initialize the game but the way it was in Phaser 2.

In Phaser 3 you initialize the game with a config object instead of parameters.

 

try this:

var config = {
    type: Phaser.AUTO,
    width: 1200,
    height: 650
};

var game = new Phaser.Game(config);

 

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...

  • Recently Browsing   0 members

    No registered users viewing this page.