Jump to content

Can't show rectangle without circle


amirantos
 Share

Recommended Posts

I just started learning Phaser 3 and faced some magic behaviour. I can't draw rectangle without circle!

This code works:

var config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    backgroundColor: 0xffffff,
    physics: {
        default: 'arcade',
        arcade: {
            gravity: { y: 200 }
        }
    },
    scene: [{
        preload: preload,
        create: create
    }]
};

var game = new Phaser.Game(config);

function preload ()
{
}

function create ()
{
    this.add.circle(config.width/2, config.height/2, 20, 0xff0000);
    this.add.rectangle(config.width/2, config.height/2 + 30, 3, 50, 0xff0000);
}

But if when I try to comment this.add.circle - nothing shows!

Is it phaser bug or am I doing something wrong?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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