0
通過單擊空格可以獲得暫停屏幕。我試圖更新分數,但我認爲如果其他循環錯誤,我沒有收到任何錯誤。 只需點擊此處,一邊玩打空間: http://www.taffatech.com/Snake.html 的代碼,很麻煩,我認爲是:暫停屏幕畫布不更新
function SetSize()
{
if (document.getElementById('Easy').checked)
{
cellSize = 10;
Mode = 1;
}
else if (document.getElementById('Medium').checked)
{
cellSize = 20;
Mode = 2;
}
else if (document.getElementById('Hard').checked)
{
cellSize = 30;
Mode = 3;
}
}
function init()
{
if (Mode == 1)
{
scoreEasy = easyScore;
if(score > scoreEasy) {
easyScore = scoreEasy;
}
}
else if (Mode == 2)
{
scoreMedium = mediumScore;
if(score > scoreMedium) {
mediumScore = score;
}
}
else if (Mode == 3)
{
scoreHard = hardScore;
if(score > scoreHard) {
highScore = score;
}
}
謝謝我想我有它的工作,除了簡單的分數顯示NaN?什麼可以解決這個問題 – bob