I’m making a website that has a canvas in it, and it works fine when I run it inside of repl.it, but when I run it outside, some of the images don’t show up.
Here is the code that makes them appear when the canvas is clicked.
Game.canvas.onclick = function(event) {
Game.mousex = event.pageX
Game.mousey = event.pageY
if (Game.selected == 'lummox') {
Game.lummox = new Game.Lummox(Game.mousex,Game.mousey)
Game.cards.push(Game.lummox)
}
}
and in a different place.
const g = setInterval(function() {
Game.ctx.clearRect(0,0,Game.canvas.width,Game.canvas.height)
Game.drawbackground()
for (let i = 0; i < Game.cards.length; i++) {
Game.cards[i].render()
}
},10)
And this is all after the images have been loaded.
Can someone tell me why this is happening?