1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 | // ex07. State
var game = new Phaser.Game(800, 600, Phaser.AUTO);
var GameState = {
create: function() {
// Set backgound color
game.stage.backgroundColor = "#0FFF0F";
// Style for text
var style = {
font: 'bold 50pt Tarzan',
fill: '#D0171B',
align: 'center'
}
// center coordinates
var x = game.world.centerX;
var y = game.world.centerY;
// Show text with x,y the center point
this.text = game.add.text(x, y, 'Hello\nPhaser\nWorld', style);
this.text.anchor.setTo(0.5);
}
}
game.state.add('GameState', GameState);
game.state.start('GameState');
|
No comments:
Post a Comment