Answer the question
In order to leave comments, you need to log in
Preloader in canvas game - how to actually understand that all canvas objects are rendered?
I'm trying to make a simple but complete game with levels etc.
I want to make a preloader, after which the drawn canvas would appear without delay.
And there are some very large uploadable images.
The scheme implies that the part that is responsible for drawing will not start drawing if, for example, imagesReady === false;
I add all loaded images to the array of objects, and try to check their readiness and be drawn like this
loadResourches(){
let t = setInterval(()=>{
let isLoad = this.gameObjects.toLoadResourches.every(item=>{
return item.object.complete != 0
|| item.object.naturalHeight != 0;
});
if(isLoad){
this.canvas.go();
clearInterval(t);
}
}, 50);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question