espace Posted August 31, 2016 Share Posted August 31, 2016 Hi, I use this snippet to have a loading bar, it works perfect expect for the alignement. My loading bar is on the left side of my game. how do you center this in the game ? I put the loading.png in attachement and also the result of the loading bar in my screen thanks for your help. var boot = function(game){ console.log("%cStarting my awesome game", "color:white; background:red"); }; boot.prototype = { preload: function(){ this.game.load.image("loading","assets/loading.png"); }, create: function(){ this.game.scale.pageAlignHorizontally = true; this.game.scale.pageAlignVertically = true; this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.state.start("Preload"); } } Link to comment Share on other sites More sharing options...
drhayes Posted August 31, 2016 Share Posted August 31, 2016 Can you show the code that actually sets that bar as the loading sprite for your game? Here's code from one of my games that centers the bar in the game screen: this.barBg = game.add.sprite(game.world.centerX, game.world.centerY, 'loading-bg'); this.barBg.anchor.setTo(0.5, 0.5); // This bar will get cropped by the setPreloadSprite function as the game loads! this.bar = game.add.sprite(game.world.centerX, game.world.centerY, 'loading-fg'); this.bar.anchor.setTo(0.5, 0.5); this.game.load.setPreloadSprite(this.bar); Link to comment Share on other sites More sharing options...
espace Posted September 6, 2016 Author Share Posted September 6, 2016 Hi drahyes, thanks for your reply in fact my snippet is the same than you. it's just that ti is splitted in different states. (bootj.js and preload.js) Link to comment Share on other sites More sharing options...
Recommended Posts