Jump to content

Phaser Can't Find/Load My Assets and Spreadsheets [HELP]


sachu
 Share

Recommended Posts

I'm trying to add sprites from a sprite sheet but the assets won't load. I've attached my code and the console logs below that show the error. I've also attached the file to show that my file location seems to be correct. I'm not sure what the issue is any help would be greatly appreciated.

debug1.PNG

debug2.PNG

debug3.PNG

Link to comment
Share on other sites

The issue is your bundler. When you add non-standard things to your 'regular' JS, you can't expect perfect interoperability with JS libraries (such as Phaser) which expect you to write in JS.

The issue lies with however your bundler transforms `./assets/button.png`, usually, this will become a file path, which would work fine if, and only if, the paths are correct. I am going to guess that in your case, they are not correct, hence the 404.

More strangely, it doesn't even try to insert a path, just the variable name, which either means you're calling Phaser functions wrong, or, the bundler is really mucking you around.

Most bundlers that allow you to import asset paths also will handle packing those assets and they _should_ also handle serving it for you in the same way they're serving your HTML and other static code assets.

Link to comment
Share on other sites

Ended up starting from scratch with a whole new local server service and for some reason, it works (exact same code). I was using NodeJS so I'm assuming I must have messed up the setup process at some point 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...