-3
我之前發佈,但我的問題是不正確的。那麼爲什麼我的拍攝沒有跟隨我的拍攝船?這只是停留在一個位置,即使我移動船離開.......我補充了我猜的一切.....出於想法..任何幫助將不勝感激。代碼與一個錯誤的船舶
function shoot(){
context.fillStyle = "black";
context.fillRect(X2, Y2--, 5,10);
context.fillStyle = "red";
context.fillRect(X2, Y2, 5,10);
if (Y2>=0) {
timer=setTimeout(shoot(), 1);
}
else {
context.fillstyle="black";
context.fillRect(X2, Y2, 5,10);
Y2=320;
context.fillRect(X+23, Y2, 5,10);
}
}