I created a div id = mygame, and inside the var config:
scale: {
parent: ‘mygame’,
autoCenter: Phaser.Scale.CENTER_BOTH
},
but does not center the game in the center of the page
I have a .css file with:
body {
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}
And in my configuration:
scale: {
mode: Phaser.Scale.FIT,
height: 270,
width: 480,
autoCenter: Phaser.Scale.CENTER_BOTH,
parent: ‘gameContainer’
},
1 Like
Hi, add to phaser config:
autoCenter: true,
2 Likes