[英]How to create a restart button for my snake game built in javascript?
var game = "play"; //This is the game variable
$("#Restart").click(function() { //Using the buttons
console.log("Restart Works");
gamerestart();
ctx.fill
});
function gamerestart(){
game = gamerestart;
ctx.fillStyle = '#00008b';
ctx.fillRect(0,0, canvas.width, canvas.height);
}
使用此方法使其他按鈕正常工作,但重新啟動一個按鈕無效嗎?
function gamerestart(){
game = gamerestart; //quotes?
ctx.fillStyle = '#00008b';
ctx.fillRect(0,0, canvas.width, canvas.height);
}
不應該是“ gamerestart”嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.