Add a preloader bar

This commit is contained in:
2014-06-15 21:17:07 -07:00
parent ccc391fa60
commit 97eaa58cc7

View File

@@ -1374,11 +1374,13 @@ Boot.prototype = Object.create(Phaser.State.prototype);
Boot.preload = function() Boot.preload = function()
{ {
console.log("Boot.preload");
game.load.image('preloader', 'gfx/ui/preloader.png'); game.load.image('preloader', 'gfx/ui/preloader.png');
}; };
Boot.create = function() Boot.create = function()
{ {
console.log("Boot.create");
this.input.maxPointers = 1; this.input.maxPointers = 1;
this.stage.disableVisibilityChange = true; this.stage.disableVisibilityChange = true;
this.stage.scale.pageAlignHoritzontally = true; this.stage.scale.pageAlignHoritzontally = true;
@@ -1391,6 +1393,7 @@ Preloader.prototype = Object.create(Phaser.State.prototype);
Preloader.prototype.preload = function() Preloader.prototype.preload = function()
{ {
console.log("Preloader.preload");
this.preloadBar = game.add.sprite(0, 0, 'preloader'); this.preloadBar = game.add.sprite(0, 0, 'preloader');
this.preloadBar.anchor.setTo(0.5, 0.5); this.preloadBar.anchor.setTo(0.5, 0.5);
this.preloadBar.x = game.camera.x + (game.camera.width / 2); this.preloadBar.x = game.camera.x + (game.camera.width / 2);
@@ -1423,7 +1426,7 @@ Preloader.prototype.preload = function()
Preloader.prototype.create = function() Preloader.prototype.create = function()
{ {
console.log("Preloader.create");
function goalready() { function goalready() {
this.preloadBar.destroy(); this.preloadBar.destroy();
game.state.start('game', true, false); game.state.start('game', true, false);