bazfer Posted February 27, 2017 Share Posted February 27, 2017 Hello, Working on initial setup, trying to display the Phaser logo using node.js and express for my local server. So, I got it to display the black back ground, which means the route is correctly displaying the index.html. The phaser logo is, however, showing as missing even though the path is correct. What am I missing? See screenshots. Thanks. Link to comment Share on other sites More sharing options...
ldd Posted February 27, 2017 Share Posted February 27, 2017 after some googling: app.use(express.static(__dirname + '/public')); bazfer 1 Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Share Posted February 27, 2017 Tried using express' static middleware and even though I got rid of the loading errors, the image is still not loading. However, it does display if I manually navigate to localhost:3000/phaser.png. Also, I did clear cache with no luck. Help? Link to comment Share on other sites More sharing options...
ldd Posted February 27, 2017 Share Posted February 27, 2017 I'm not entirely sure that phaser works 100% on node, without at least a fake canvas and jsdom... again, after some googling here is a forum thread that might be interesting to you bazfer 1 Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Share Posted February 27, 2017 Found the solution: the provided code was missing 'game.load.start( )'. Hint, hint Phaser Documentation Team. Link to comment Share on other sites More sharing options...
mattstyles Posted February 27, 2017 Share Posted February 27, 2017 1 hour ago, ldd said: I'm not entirely sure that phaser works 100% on node, without at least a fake canvas and jsdom... Phaser isn't running on node, at present express is only there as a static server. Link to comment Share on other sites More sharing options...
drhayes Posted February 27, 2017 Share Posted February 27, 2017 You shouldn't need to start the loader manually at all by calling "game.load.start()". Where did you put that that your code started working? Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Share Posted February 27, 2017 11 minutes ago, drhayes said: You shouldn't need to start the loader manually at all by calling "game.load.start()". Where did you put that that your code started working? function preload() { game.load.image('logo', '/phaser.png'); game.load.start(); } Link to comment Share on other sites More sharing options...
drhayes Posted March 1, 2017 Share Posted March 1, 2017 Yeah, quoting from the docs for Phaser.Loader.start: Quote Start loading the assets. Normally you don't need to call this yourself as the StateManager will do so So that's weird. Can you use 2.6.2 instead of 2.5? See if there was a bug there, or something? Link to comment Share on other sites More sharing options...
samme Posted March 1, 2017 Share Posted March 1, 2017 @bazfer do you just want to run a local server? You can just open the directory and run http-server -c1 Link to comment Share on other sites More sharing options...
bazfer Posted March 2, 2017 Author Share Posted March 2, 2017 9 hours ago, drhayes said: Yeah, quoting from the docs for Phaser.Loader.start: So that's weird. Can you use 2.6.2 instead of 2.5? See if there was a bug there, or something? That did it. TY. Link to comment Share on other sites More sharing options...
bazfer Posted March 2, 2017 Author Share Posted March 2, 2017 5 hours ago, samme said: @bazfer do you just want to run a local server? You can just open the directory and run http-server -c1 Got it working but appreciate the time to reply. Link to comment Share on other sites More sharing options...
Recommended Posts