Search code examples
javascriptfirebase-hostingphaser-framework

Phaser 3 image is unable to load when I host the website


so I am working on a game using Phaser framework. Everything is going smoothly until I deploy using firebase. For some reason, when I try to host the game using firebase, I get an error which shows that the image cannot be foundenter image description here

The error that I get is as such: "Failed to load resource: the server responded with a status of 404 () ". When I change that asset to another image, it also has the same issue. However, when if I were to open the html file in browser, the asset does load and I can see the image. I am not sure why there is an issue like such, but if you are able to help me out, it would be much appreciated

The code below is how I add the image into the picture

preload() {
    this.load.image("engineershirt", "SLICES/upperpri/sm1.png/");
}

create() {
    const engineershirttop = this.add.image(320, 550, "engineershirt");
    engineershirttop.setScale(0.55);
    engineershirttop.setDepth(12);
    engineershirttop.setVisible(true);
}

Solution

  • the slash /at the end is too much, it should only be this.load.image("engineershirt", "SLICES/upperpri/sm1.png");