this.Player[this.Player.length] = new Player(i, j);
break;
case "1":
this.DrawBox(i, j, "box"+i+"_"+j, " ");
this.DrawBox(i, j, "player1", "♂");
this.Player[this.Player.length] = new Player(i, j);
break;
}
}
}
}
this.Campaign = function(self, other){
if (self == other) return 0;
if (this.Player[other].state == 2)
{
this.Player[other].state = 0;
document.getElementById("player"+other).style.display = 'none';
this.End();
alert("Player"+self+" Win!");
}
}
//移动选手
this.Move = function(addx, addy, who){
if (this.Player[who].state != 1) return 0;
var old = this.Map[this.Player[who].x][this.Player[who].y];
this.Player[who].x = addx+this.Player[who].x;
this.Player[who].y = addy+this.Player[who].y;
var str = " 01np";
if (str.indexOf(this.Map[this.Player[who].x][this.Player[who].y]) != -1)
{
document.getElementById("player"+who).style.left = this.Player[who].x*this.BoxWidth;
document.getElementById("player"+who).style.top = this.Player[who].y*this.BoxHeight;
this.Map[this.Player[who].x-addx][this.Player[who].y-addy] = old;
switch(this.Map[this.Player[who].x][this.Player[who].y])
{
case "n":
this.Map[this.Player[who].x][this.Player[who].y] = " ";
this.ReDrawBox(this.Player[who].x, this.Player[who].y, " ");
this.Player[who].popo++;
this.Player[who].remain++;
来源:upschool.com.cn
作者:hxyman
关键字:脚本游戏,web泡泡堂,人机大战
发表日期:2007-1-16 23:03:13
网页显示有限 阅读全文请下载本文完整版WORD文档
上一篇:javascript读取RSS数据 下一篇:预载Gif的2个JS代码(非常有用)
共9页
9 7 [
1] [
2] [
3] [
4] [
5] [
6] [
7] [
8] [
9]
8 :>
2008-11-23 20:37:12