Savo27 Posted August 17, 2018 Share Posted August 17, 2018 Hello to everyone I'm new with phaser 3, i'm having a lot of problems with loading images So, my index.html is <html> <head> <script src="phaser.js" ></script> <script src="example.js" ></script> <script src="game.js" ></script> <script src="example2.js" ></script> <script src="example3.js" ></script> </head> <body></body> </html> example.js class example extends Phaser.Scene{ constructor() { super({Key:"example"}); } preload() { this.load.image('GFS','assets/GFS.jpg'); } create() { this.image = this.add.image(800,640,'GFS'); } } game.js var config = { type: Phaser.AUTO, width: 800, eight : 640, physics: { default: 'arcade', arcade : { gravity : {y:200} } }, scene : [ example ] }; var game = new Phaser.Game(config); The error on chrome's console is phaser.js:39287 Failed to load file:///C:/Users/extro/Google%20Drive/Project/HTML/Index/assets/GFS.jpg: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. I can't find an answer to that on google or something else, I'm using xampp server. I've also another problem to reach <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js"></script> with chrome is displayed well on the URL, but in a scritp it give back that error Failed to load resource: net::ERR_FILE_NOT_FOUND phaser.js:1 part1.html:18 Uncaught ReferenceError: Phaser is not defined at part1.html:18 Link to comment Share on other sites More sharing options...
mapacarta Posted August 18, 2018 Share Posted August 18, 2018 Are you using a web server? The error you are getting is the error when you try to run phaser locally. The easiest way to use a web server locally is using Brackets's live preview I guess. Also you can take a look at the getting started guide: http://phaser.io/tutorials/getting-started-phaser3 Link to comment Share on other sites More sharing options...
Savo27 Posted August 18, 2018 Author Share Posted August 18, 2018 8 hours ago, mapacarta said: Are you using a web server? The error you are getting is the error when you try to run phaser locally. The easiest way to use a web server locally is using Brackets's live preview I guess. Also you can take a look at the getting started guide: http://phaser.io/tutorials/getting-started-phaser3 TY mapacarta for the reply I'm using xammp as a web server Link to comment Share on other sites More sharing options...
Savo27 Posted August 20, 2018 Author Share Posted August 20, 2018 none? Link to comment Share on other sites More sharing options...
mapacarta Posted August 20, 2018 Share Posted August 20, 2018 If you are using xammp, then you should test the game on http://127.0.0.1 Currently it seems like you are trying to test the game on local protocol(file://) About the other error you can try loading Phaser from: https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser.js Link to comment Share on other sites More sharing options...
Savo27 Posted August 21, 2018 Author Share Posted August 21, 2018 Same error, I can't understand Thx mapa Link to comment Share on other sites More sharing options...
Savo27 Posted August 21, 2018 Author Share Posted August 21, 2018 I have found the problem. phaser.AUTO is not good now, you have to use phaser.CANVAS Link to comment Share on other sites More sharing options...
Recommended Posts