//Read Map
this.Map = new Array();
for (var i=0; i<this.MapMaxX; i++)
{
this.Map[i] = new Array();
for (var j=0; j<this.MapMaxY; j++)
{
this.Map[i][j] = this.SetMap[this.MapIndex][j].charAt(i)
}
}
//道具
this.Equip = new Array("","","","","n","","","p","");
this.DrawBox = function(x, y, id, str){
Canvas.insertAdjacentHTML("beforeEnd","<span id='"+id+"' style='position:absolute;left:"+(x*this.BoxWidth)+";top:"+(y*this.BoxHeight)+";width:"+this.BoxWidth+";height:"+this.BoxHeight+";font-size:40px;'>"+str+"</span>");
}
this.InitBulb = function(n){
for (var i=0; i<n; i++)
{
Canvas.insertAdjacentHTML("beforeEnd","<span id='bulb"+i+"' style='position:absolute;width:"+this.BoxWidth+";height:"+this.BoxHeight+";font-size:40px;display:none;color:blue;'>●</span>");
}
}
this.ReDrawBox = function(x, y, str){
document.getElementById("box"+x+"_"+y).innerHTML = str;
}
this.InitMap = function(){
for (var i=0; i<this.MapMaxX; i++)
{
for (var j=0; j<this.MapMaxY; j++)
{
switch(this.Map[i][j])
{
case "#":
this.DrawBox(i, j, "box"+i+"_"+j, "<span style='color: mediumseagreen'>■</span>");
break;
case " ":
this.DrawBox(i, j, "box"+i+"_"+j, " ");
break;
case "k":
this.DrawBox(i, j, "box"+i+"_"+j, "<span style='color: tan'>■</span>");
break;
case "0":
this.DrawBox(i, j, "box"+i+"_"+j, " ");
this.DrawBox(i, j, "player0", "♀");
来源: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:22:32