I have made a function in a javascript file to dynamically load images based on variables.
I need for my game to be ok with sometimes trying to load a file that isn't there.
I want it to not load any image, and carry on with the game.
As far as I know there is no way to safely check if a file exists before trying to load it.
I have encased the $gameScreen.showPicture in a try block, with a catch(err) {return;} following it,
but it still stops the program the same as if the try/catch was not there.
So what is the point of a try catch? It doesn't work.
I need for my game to be ok with sometimes trying to load a file that isn't there.
I want it to not load any image, and carry on with the game.
As far as I know there is no way to safely check if a file exists before trying to load it.
I have encased the $gameScreen.showPicture in a try block, with a catch(err) {return;} following it,
but it still stops the program the same as if the try/catch was not there.
So what is the point of a try catch? It doesn't work.