javascript坦克小游戏
第一部分
JScript code:
<script type="text/javascript">
static_id=0;
XPrang=function(srcBox,targetBox){
var x=Math.abs(srcBox.left-targetBox.left);
var xDistance=srcBox.width/2+targetBox.width/2;
if(x<xDistance)
return true;
else
return false;
};
YPrang=function(srcBox,targetBox){
var y=Math.abs(srcBox.top-targetBox.top);
var yDistance=srcBox.height/2+targetBox.height/2;
if(y<yDistance)
return true;
else
return false;
};
IsPrang=function(srcBox){
for(var _i in Game.Boxs){
if(srcBox.id==Game.Boxs[_i].id)
continue;
else if(XPrang(srcBox,Game.Boxs[_i])&&YPrang(srcBox,Game.Boxs[_i])){
if(IsDestroy(srcBox,Game.Boxs[_i])=='destroy'){
srcBox.Destroy();
Game.Boxs[_i].Destroy();
return false;
}
else
return true;
}
}
return false;
};
IsDestroy=function(srcBox,targetBox){
var srcType=srcBox.id.split('_')[0];
var targetType=targetBox.id.split('_')[0];
var value=srcType+'X'+targetType;
var msg=null;
switch(value){
相关问答:
<html>
<head>
<title></title>
</head>
<body>
<font color="#0000FF"><b>请在文本框1中输入文字:</b>
<form>
<input ......
我的源文件如下:
<html>
<head> <title>show picture </title>
<script>
function change(fileName)
{
  ......
我也来一个趣味javascript:
打开以下html文件,依次按下G,L,C三个键,就会有奇迹出现!!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" ......
void CWEHelperDlg::OnOK(){
CString code;
//调用VBSCRIPT,能弹出消息框,也能正确返回 hello
code = "function main()\r\n\tMsgBox \"ok\"\r\n\tmain=\"hello\"\r\nend functio ......