0
私は、ゲームが始まるとスプラッシュ画面を表示しようとしていますが、表示されますが、あまりにも速く消えてしまいます。関数内でsetTimeoutを作成しようとしましたが、動作を停止してコードを完全に解除します。Javascriptスプラッシュ画面setTimeoutの問題。
var introimg;
var intro = true;
function gameStart() {
ctx.clearRect(0,0,window.innerWidth, window.innerHeight);
ctx.drawImage(introimg, 0,0,window.innerWidth, window.innerHeight);
//setTimeout(gameStart, 5000);
}
function setup(){
introimg = new Image();
introimg.src = 'ICE/data/splash.png';
document.addEventListener("touchstart", onTouchStart);
document.addEventListener("touchmove", onTouchMove);
document.addEventListener("touchend", onTouchEnd);
gameStart();
draw();
}
function draw(){
ctx.fillStyle = "rgba(0,0,0,0.1)";
ctx.fillRect(0,0,window.innerWidth,window.innerHeight);
for(var i = 0;i<ressources.length;i++){
ressources[i].display();
}
requestAnimationFrame(draw);
}
助けてください。
ありがとうございます。
あなたはおそらく 'gameStartを()を交換する必要があります;'; 'に' 'のsetTimeout(gameStart、5000)によってsetup'。 – Xufox