这段代码渲染了玩家的动作,改变了画面。在本地,它在服务器上工作正常,更改图片不可见。但是,如果您取消注释警报(“right1”);和警报(“right2”);将被视为图像变化。怎么让服务器也看到图片变了?
var timer;
function GoRight(toPosition, level, mines) {
clearInterval(timer);
var left = $("#man").position().left;
var top = $("#man").position().top;
$("#man").attr('style', 'position:absolute;display:block;left:' + left + 'px;top:' + top + 'px;')
$("#man").attr("class", "");
var tempi = 0;
timer = setInterval(
function () {
if (left >= toPosition) {
left = toPosition;
$("#man").attr('style', 'position:absolute;display:block;left:' + left + 'px;top:' + top + 'px;')
clearInterval(timer);
$("#man").attr('src', '/content/games/kamikaze2/right0.gif');
return;
}
tempi += 8;
left += 8;
$("#man").attr('style', 'position:absolute;display:block;left:' + left + 'px;top:' + top + 'px;')
if (tempi % 16 == 0) {
// alert("right1");
$("#man").attr('src', '/content/games/kamikaze2/right1.gif');
}
else {
// alert("right2");
$("#man").attr('src', '/content/games/kamikaze2/right2.gif');
}
}, 70);
}