This repository was archived by the owner on Jan 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflag.js
More file actions
54 lines (45 loc) · 1.31 KB
/
flag.js
File metadata and controls
54 lines (45 loc) · 1.31 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
var wasFontLoaded = false;
var wasGameLoaded = false;
function createText(game) {
if (!wasFontLoaded || !wasGameLoaded) return;
var fancyStyle = { font: '30px "Amatica SC"', fill: '#fff'};
game.add.text(
game.world.width / 2,
game.world.height,
'Duelo a Garrotazos – Goya',
fancyStyle
).anchor.setTo(0.5, 1);
}
var PreloaderScene = {
preload: function () {
var font = new FontFaceObserver('Amatica SC');
font.load().then(function () {
wasFontLoaded = true;
createText();
}, function () {
console.log('Error loading font');
});
this.game.add.text(300, 150, 'Loading', {
font: '60px monospace',
fill: '#fff',
}).anchor.setTo(0.5);
this.game.load.image('background', 'background.png');
},
create: function () {
this.game.state.start('play');
}
};
var GameScene = {
create: function () {
this.game.add.image(0, 0, 'background');
wasGameLoaded = true;
createText(this.game);
}
};
window.onload = function () {
var game = new Phaser.Game(625, 300, Phaser.AUTO, 'game');
game.state.add('preloader', PreloaderScene);
game.state.add('play', GameScene);
game.state.start('preloader');
};