bazfer Posted February 27, 2017 Report 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. Quote Link to comment Share on other sites More sharing options...
ldd Posted February 27, 2017 Report Share Posted February 27, 2017 after some googling: app.use(express.static(__dirname + '/public')); bazfer 1 Quote Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Report 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? Quote Link to comment Share on other sites More sharing options...
ldd Posted February 27, 2017 Report 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 Quote Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Report Share Posted February 27, 2017 Found the solution: the provided code was missing 'game.load.start( )'. Hint, hint Phaser Documentation Team. Quote Link to comment Share on other sites More sharing options...
mattstyles Posted February 27, 2017 Report 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. Quote Link to comment Share on other sites More sharing options...
drhayes Posted February 27, 2017 Report 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? Quote Link to comment Share on other sites More sharing options...
bazfer Posted February 27, 2017 Author Report 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(); } Quote Link to comment Share on other sites More sharing options...
drhayes Posted March 1, 2017 Report 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? Quote Link to comment Share on other sites More sharing options...
samme Posted March 1, 2017 Report 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 Quote Link to comment Share on other sites More sharing options...
bazfer Posted March 2, 2017 Author Report 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. Quote Link to comment Share on other sites More sharing options...
bazfer Posted March 2, 2017 Author Report 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.