-
Notifications
You must be signed in to change notification settings - Fork 0
/
PantallaDeCargado.js
54 lines (42 loc) · 1.42 KB
/
PantallaDeCargado.js
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
var WebFontConfig = {
google: {
// Agregar la fuente de google que se quiere usar...
families: ['Indie Flower', 'Permanent Marker', 'Stardos Stencil']
}
};
var PantallaDeCargado = {
preload: function() {
text = AñadirTexto(300,240,"",'#FFFFFF',45);
progress_text = AñadirTexto(350,350,"",'#FFFFFF',20);
// You can listen for each of these events from Phaser.Loader
game.load.onLoadStart.add(loadStart, this);
game.load.onFileComplete.add(fileComplete, this);
game.load.onLoadComplete.add(loadComplete, this);
loadAll();
game.load.start();
},
create: function()
{
},
};
function loadStart(){
text.setText("Cargando");
}
function fileComplete(progress, cacheKey, success, totalLoaded, totalFiles){
// progress_text.setText("File Complete: " + progress + "% - " + totalLoaded + " out of " + totalFiles);
progress_text.setText("Progreso: "+ progress + "%");
}
function loadComplete(){
text.position.x = text.position.x-60; // up 1 pixel
text.setText("Carga Terminada");
button = game.add.button(game.world.centerX - 30, 400, 'PlayButton', terminarCargado, this, 2, 1, 0);
button.frame = 0;
button.i = 0;
button.inputEnabled = true;
button.events.onInputDown.add(TerminarNivel, this);
button.events.onInputOver.add(overButton, this);
button.events.onInputOut.add(outButton, this);
}
function terminarCargado(){
game.state.start('PantallaDeInicio');
}