ninja
1
I want the text to be centered.
const config = {
type: Phaser.AUTO,
parent: 'game',
width: 1530,
heigth: 600,
// backgroundColor: "#000000",
scale: {
mode: Phaser.Scale.FIT,
autoCenter: Phaser.Scale.CENTER_BOTH
},
scene: {
preload,
create,
update,
},
physics: {
default: 'arcade',
arcade: {
gravity: {
y: 300
},
debug: true,
},
}
};
ninja
3
I’m sorry I wasn’t clearer.
I want to put the word “Game Over” in the center.
samme
4
And what code do you have now?
ninja
5
Thanks for the replies.
this.over = this.add.text(560, 580 / 2).setScrollFactor(0).setFontSize(80).setColor('#ffffff');
this.over.setText('GAME OVER!');
ninja
6
this.physics.world.setBounds(0, 0, 3100 * 2, 380 * 2);
this.cameras.main.setBounds(0, 0, 3100 * 2, 100 * 2);
this.cameras.main.setZoom(1.1);
samme
7
const { centerX, centerY } = this.cameras.main;
this.add.text(centerX, centerY, 'GAME OVER!').setOrigin(0.5, 0.5);
1 Like