dmtrgrbn Posted May 24, 2016 Share Posted May 24, 2016 Hi, i'm new here and I'm a beginner with Phaser. I'm currently following a Zenva course to familiarise myself with the framework. I am currently having an issue when I launch the project. Chrome's console always return me this : "Phaser.Cache.getImage: Key "logo" not found in Cache. Phaser.Cache.getImage: Key "preloaderBar" not found in Cache." Can you help me with this ? As a beginner it's really hard for me to find the problem... Here are my Boot and Preloader files : BOOT var SSFRunner = function() {}; SSFRunner.Boot = function() {}; SSFRunner.Boot.prototype = { preload: function() { this.load.image('logo','assets/images/logo.png'); this.load.image('preloaderBar','assets/images/preloader-bar.png'); }, create: function() { this.game.stage.backgroundColor = '#fff'; this.input.maxPointers = 1; if(this.game.device.desktop) { this.scale.pageAlignHorizontally = true; } else { this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.minWidth = 568; this.scale.minHeight = 600; this.scale.maxWidth = 2048; this.scale.maxHeight = 1536; this.scale.forceLandscape = true; this.scale.pageAlignHorizontally = true; this.scale.setScreenSize(true); } this.state.start('preloader'); } }; PRELOADER SSFRunner.Preloader = function(game) { this.ready = false; }; SSFRunner.Boot.prototype = { preload: function() { this.background = this.add.sprite(this.game.world.centerX, this.game.world.centerY, 'logo'); this.background.anchor.setTo(0.5, 0.5); this.preloadBar = this.add.sprite(this.game.world.centerX, this.game.world.centerY + 128, 'preloaderBar'); this.preloadBar.anchor.setTo(0.5, 0.5); this.load.setPreloadSprite(this.preloadBar); this.load.image('ground', 'assets/images/tiles/ground.png'); this.load.image('background', 'assets/images/tiles/background.png'); this.load.image('foreground', 'assets/images/tiles/foreground.png'); this.load.spritesheet('coins', 'assets/images/coin-spritesheet.png', 51, 51, 7); this.load.spritesheet('player', 'assets/images/jetpack-spritesheet.png', 229, 296, 4); this.load.spritesheet('missile', 'assets/images/missile-spritesheet.png', 361, 218, 7); this.load.audio('gameMusic', ['assets/audio/Pamgaea.mp3', 'assets/audio/Pamgaea.ogg']); this.load.audio('rocket', 'assets/audio/rocket.wav'); this.load.audio('bounce', 'assets/audio/bounce.wav'); this.load.audio('coin', 'assets/audio/coin.wav'); this.load.audio('death', 'assets/audio/death.wav'); this.load.onLoadComplete.addOnce(this.onLoadComplete, this); }, create: function() { this.preloadBar.cropEnabled = false; }, update: function() { if (this.cache.isSoundDecoded('gameMusic') && this.ready == true) { this.state.start('MainMenu'); } }, onLoadComplete: function() { this.ready = true; } }; Link to comment Share on other sites More sharing options...
drhayes Posted May 24, 2016 Share Posted May 24, 2016 Check out this line from your Preloader file above: "SSFRunner.Boot.prototype". I bet you meant "SSFRunner.Preloader.prototype". Link to comment Share on other sites More sharing options...
dmtrgrbn Posted May 24, 2016 Author Share Posted May 24, 2016 8 minutes ago, drhayes said: Check out this line from your Preloader file above: "SSFRunner.Boot.prototype". I bet you meant "SSFRunner.Preloader.prototype". Thanks drhayes, it was exactly this. I got some help on the chat and they helped me a lot. Thank you Link to comment Share on other sites More sharing options...
drhayes Posted May 24, 2016 Share Posted May 24, 2016 Are you in the Slack channel? Link to comment Share on other sites More sharing options...
Recommended Posts