1
I made a mini game on the localhost and everything was working perfectly.. Then I uploaded it to the web server and the game started crashing with the error "NS_ERROR_NOT_AVAILABLE:".
...
var spriteSheet = new Image();
var player = new Sprite(spriteSheet);sprites.push(player);
...
for (var i in sprites) {
var spr = sprites[i];
if (spr.visible) {
spr.draw(ctx); // erro aqui
}
}
...
(in another file . js)
...
this.draw = function(ctx){
ctx.drawImage(this.img, this.srcX, this.srcY, this.width, this.height,this.posX,this.posY, this.width, this.height); // erro aqui
this.animation();
}
...
I have been researching on this subject and I think we need to create a function to load the images before initializing the game itself.
This error appears in the browser or server?
– Sergio
Error appears in browser
– David Ricardo