js中函数未定义错误
<html><head><title>Tank</title></head><bodyonload="initialize()"onkeydown="controlPla...
<html>
<head>
<title>Tank</title>
</head>
<body onload="initialize()" onkeydown="controlPlayers()">
<canvas id="display" height=500 width=450>
Sorry, your browser is too out of date to support this game!
</canvas>
<script>
var internal = 30;
var DOM_VK_UP=38;
var DOM_VK_DOWN=40;
var DOM_VK_LEFT=37;
var DOM_VK_RIGHT=39;
var DOM_VK_RETURN=13;
var DOM_VK_W=87;
var DOM_VK_A=65;
var DOM_VK_S=83;
var DOM_VK_D=68;
var DOM_VK_SPACE=32;
var DOM_VK_R=82;
var DOM_VK_P=80;
var wall =new Array(45);
gameTimer=setInterval("game();",internal);
for(var i=0;i<50;i++)
{
wall[i]=new Array[45];
}
function randomInt(num)
{
return dir=Math.floor(Math.random()*num);
}
function initialize()
{
wall[randomInt(50)][randomInt(45)]=1;
var ob=new snake(0,0);
draw();
}
报错说initialize未定义,请问各位大神哪里出错了阿 展开
<head>
<title>Tank</title>
</head>
<body onload="initialize()" onkeydown="controlPlayers()">
<canvas id="display" height=500 width=450>
Sorry, your browser is too out of date to support this game!
</canvas>
<script>
var internal = 30;
var DOM_VK_UP=38;
var DOM_VK_DOWN=40;
var DOM_VK_LEFT=37;
var DOM_VK_RIGHT=39;
var DOM_VK_RETURN=13;
var DOM_VK_W=87;
var DOM_VK_A=65;
var DOM_VK_S=83;
var DOM_VK_D=68;
var DOM_VK_SPACE=32;
var DOM_VK_R=82;
var DOM_VK_P=80;
var wall =new Array(45);
gameTimer=setInterval("game();",internal);
for(var i=0;i<50;i++)
{
wall[i]=new Array[45];
}
function randomInt(num)
{
return dir=Math.floor(Math.random()*num);
}
function initialize()
{
wall[randomInt(50)][randomInt(45)]=1;
var ob=new snake(0,0);
draw();
}
报错说initialize未定义,请问各位大神哪里出错了阿 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询