Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

HTML5 game : image does not load

A topic by Casual42 created Apr 03, 2018 Views: 1,667 Replies: 6
Viewing posts 1 to 3
(1 edit)

Hi !

I'm making an HTML5 game. The game has a lot of files and loads around 220 images. Until recently, it worked, but now 4 of the images fail to load (their .complete flag is 'true' but .onload() never triggers, and an exception triggers when trying to draw, which indicates that the loading failed).

So I changed the program so it detects the images that fail to load and retries to load them. The images still don't load.

Any idea what's happening ?

Admin(+1)

Can you share a link to the game? It doesn't need to be public, we can still see it. 

Images are uploaded directly to our file host. We don't change them in any way. You should always use a relative path when trying to load files, since your game is not at the top level directory of the domain. Often you can look in the browser console to get a hint about what is going on.

Hi !  Did you see my reply ? Please let me know if you notice anything that could cause this bug. Thanks !

Admin

Sorry, I didn't see you reply since you didn't reply to me but you posted in the top of the topic.

Thanks for the interest ! I appreciate it !

There is the game :

https://casual42.itch.io/you-shall-not-pass

I use relative paths for all my files.

In fact, the images that fail to load are always the same 4. Moreover, they are part of a series of 10 images that are very similar in all aspects, and the others load fine.

The images are sorted in an object called 'allImages'. The keys of the images that fail to load are :

item_emblemWisdom

yellow 1

yellow 2

yellow 3

The console also indicates that https://cdn.siftscience.com/s.js failed to load. I'm pretty sure it's an element added by itch.io, but don't think it's a big deal.

Today I've been looking for a way to get more information from an error Event. If you know how, I can add it to the code, but for now, I don't think I can get more information from the console.

Admin

Thanks for the info. Our server is case sensitive, so you must match the capitalization of the file names exactly.

Yes ! That's it ! Oh how could I miss it ! Thanks !

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.