AtomDream
---小时侯喜欢年轻漂亮的女孩, ------长大了依然喜欢年轻漂亮的女孩

中秋快乐,送给大家个webgame
http://www.atomdream.com/webgame.htm?塞尔
把链接后面的塞尔改成你的名字,你就是男主角了,再把网址发给你的女友玩就行了。

由于赶着在中秋做好,所以后面代码有点乱,迟些会再做修改,欢迎提出bug

先送上js代码,修改后再添加后台代码一起发上

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    
<meta name="Generator" content="EditPlus">
    
<meta name="Author" content="">
    
<meta name="Keywords" content="">
    
<meta name="Description" content="">
    
<style type="text/css">
        body
        
{
            font: 12px Tahoma;
            margin: 
0;
            padding: 
0;
            text
-align: center;
        }

        .zzs
        
{
            background
-color: Black;
            filter: alpha(opacity
=50);
            position: absolute;
            z
-index: 100;
            top: 
0;
            left: 
0;
        }

        .gos
        
{
            border: solid 3px white;
            margin
-top: 160px;
            text
-align: center;
            background
-color: Yellow;
            width: 300px;
            height: 180px;
        }

        .pagebody
        
{
            margin: 
0 auto;
            width: 800px;
            text
-align: center;
        }

        .titles
        
{
            border: solid 5px black;
            height: 80px;
            font
-size: 50px;
            font
-style: oblique;
            font
-weight: 900;
        }

        .maps
        
{
            
float: left;
        }

        .maps table
        
{
            text
-align: center;
            border: solid 5px black;
            background
-image: url(                          "image/mapw.jpg" );
        }

        .maps td
        
{
            width: 30px;
            height: 30px;
        }

        .menus
        
{
            
float: left;
            text
-align: center;
        }

        .sz
        
{
            text
-align: center;
            height: 95px;
            background
-color: #cccccc;
            border: solid 5px black;
            width: 
100%;
        }

        .elsz
        
{
            width: 60px;
            height: 60px;
            background
-image: url(                          "image/allshuaizi.gif" );
            background
-position: -300px 0;
            cursor: hand;
        }

        .elszss
        
{
            width: 60px;
            height: 60px;
            background
-color: blue;
            filter: alpha(opacity
=50);
            display: none;
        }

        .msgs
        
{
            background
-color: #666666;
            height: 365px;
            border: solid 5px black;
            width: 
100%;
        }

        .areamsg
        
{
            font
-size: 12px;
            color: Yellow;
            background
-color: #666666;
            border: 
0;
        }

        .botms
        
{
            height: 30px;
            text
-align: left;
            border: solid 5px black;
        }

        .botmsgs
        
{
            color: Yellow;
            height: 
100%;
            width: 320px;
            
float: left;
            background
-color: black;
        }

        .botmsgrs
        
{
            height: 
100%;
            width: 470px;
            
float: left;
            background
-color: #666666;
        }

        .dsps
        
{
        font
-size:15px;
            border: solid 5px black;
            position: absolute;
            z
-index: 101;
            top: 120px;
            left: 200px;
            text
-align: left;
            background
-color: #828282;
            width: 450px;
            height: 140px;
            display: none;
        }

        .dspss
        
{
            
float: right;
            margin
-top: 100px;
            cursor: hand;
            color: Yellow;
        }

    
</style>

    
<script src="prototype.js" type="text/javascript"></script>

    
<script type="text/javascript">
//  var $=function(el){
//
  return document.getElementById(el);
//
  }
    var webgame=new Object();
    
function loadXML(xmlFile) 
{
var xmlDoc;
if(window.ActiveXObject) 
{
xmlDoc    
= new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async    
= false;
xmlDoc.load(xmlFile);
}
 
else if (document.implementation&&document.implementation.createDocument) 
{
xmlDoc    
= document.implementation.createDocument('', '', null);
xmlDoc.load(xmlFile);
}
 
else 
{
return null;
}
 
return xmlDoc;
}
 
  webgame.arr
=new Array();
  webgame.arr
=[295,275,255,254,253,252,251,271,270,289,267,247,246,227,208,190,169,170,151,132,131,110,109,128,127,146,145,144,143,164,203];
//  webgame["a267"]=0;webgame["a169"]=0;webgame["a109"]=0;webgame["a127"]=0;webgame["a143"]=0;webgame["a203"]=0;webgame["a132"]=0;
//
  webgame["a7"]=0;webgame["a6"]=0;webgame["a5"]=0;webgame["a4"]=0;webgame["a3"]=0;webgame["a2"]=0;webgame["a1"]=0;
webgame.rate=new Array();
webgame.rate
=[295,127,203,143,267,132];
webgame.ratemsg
=new Array();
webgame.ratemsg.push(
"→→多靓女怡红院");
webgame.ratemsg.push(
"面粉棒\n→→输光光赌场");
webgame.ratemsg.push(
"筛子和筛钟\n→→专坑人市集");
webgame.ratemsg.push(
"低筋面粉\n麦芽糖\n水\n花生油\n奶酪粉\n盐\n蛋\n小苏打粉\n→→空地");
webgame.ratemsg.push(
"鸡蛋\n莲蓉\n→→望月楼");
webgame.ratemsg.push(
"爱心");
  webgame.gamenow
=0;
  webgame.gameover
=6;
        webgame.OO
="塞尔";
        webgame.jl
=0;
    
var hrefs=document.location.href;       
     
if(hrefs.indexOf("?")>0)
     
{
     webgame.OO
=hrefs.split("?")[1];
     }

     document.title
="AtomDream-WebGame:寻找"+webgame.OO+"(中秋特别版)";
  webgame.girl
="image/girl.gif";
  webgame.oldseat
=0;
  webgame.nowseat
=0;
  webgame.amount
=0;
  
function loadgame(el){
  $(
"zz2").style.width=document.body.clientWidth;
  $(
"zz2").style.height=document.body.clientHeight;
  el.style.width
=document.body.clientWidth;
  el.style.height
=document.body.clientHeight;
  setTimeout(
function(){setmap($("_t_map"),20,15);},500);
  }

  
function setmap(el,w,h){
  
for(var i=0;i<h;i++)
  
{
  
var tr=el.insertRow();
  
for(var j=0;j<w;j++)
  
{
  
var td=tr.insertCell();
  
var num=j+i*20;
  
//td.onclick=(function(num){return function(){$("Text1").value+=num+",";}})(num);
  }

  }

  }

  
function setname(el){
  
if(el.value == ""){
  alert(
"你不会没有名字吧?");
  }

  
else{
  webgame.XX
=el.value;

  $(
"_d_zz").style.display="none";
var mapTD=$("_t_map").getElementsByTagName("td");
mapTD[webgame.arr[
0]].innerHTML="<img src='"+webgame.girl+"' />";
alertMsg(
0);
loadlove(
0);
  }

  }


function loadlove(nexts){
var adve=webgame.xmllove.childNodes(1).childNodes(nexts);
var loves=adve.getAttribute("xx")+"在中秋寻找"+adve.getAttribute("oo")+"的过程中经历了"+adve.getAttribute("jl")+"步,用时"+adve.getAttribute("utime")+"秒,得到"+adve.getAttribute("bulen")+"个小型月饼,最后"+adve.getAttribute("xx")+""+adve.getAttribute("oo")+":"+adve.getAttribute("str");
$(
"marmsg").innerHTML=loves;
if(webgame.xmllove.childNodes(1).childNodes.length-1){nexts=0;}
setTimeout(
function(){loadlove(nexts+1);},15000);
}


  
function szGo(el){
  $(
"_sz_zz").style.display="block";
  el.onclick
=null;
  
this.e=el;
  
this.sznum=1;
  
this.direct=$("gofront").checked;
        
if(webgame.oldseat==0 || webgame.oldseat==webgame.arr.length-1)
      
{
      
if( webgame.oldseat==0){this.direct=true;}
      
else{this.direct=false;}
      }

  setTimes(szChange);
  }

  
function setTimes(fun){
    webgame.sztime
=setInterval(fun,50);
    setTimeout(setTimeo,
1000);
    
  }

  
function setTimeo(){
  window.clearInterval(webgame.sztime);
  webgame.amount
+=this.sznum;
if(this.direct){webgame.nowseat+=this.sznum;if(webgame.nowseat>webgame.arr.length-1){webgame.nowseat=2*webgame.arr.length-2-webgame.nowseat;}}
else{webgame.nowseat-=this.sznum;if(webgame.nowseat<0){webgame.nowseat=this.sznum-webgame.oldseat;}};
  girlGo();

  }

  
  
function szChange(){
  
var rannum=Math.floor(Math.random()*6);
  
this.sznum=rannum+1;
  
this.e.style.backgroundPositionX=(0-rannum*60)+"px";
  }

  
  
function girlGo(){
    
var mapTD=$("_t_map").getElementsByTagName("td");
      mapTD[webgame.arr[webgame.oldseat]].innerHTML
="";
if(this.direct){  webgame.oldseat++;if(webgame.oldseat==webgame.arr.length-1){this.direct=false;}}
      
else{ webgame.oldseat--;if(webgame.oldseat==0){this.direct=true;}}
  mapTD[webgame.arr[webgame.oldseat]].innerHTML
="<img src='"+webgame.girl+"' />";
  
if(webgame.oldseat==webgame.nowseat){
  alertMsg(
0);
  $(
"_sz_zz").style.display="none";
  $(
"_d_botmsg").innerText=webgame.XX+",你现在已走了"+webgame.amount+"步,所用时间为"+Math.floor((new Date()-webgame.starts)/1000)+"秒,得到"+webgame.jl+"个小型月饼";
    
this.e.onclick=function(){szGo(this);};
  
return false;
  }

  
else{
  setTimeout(girlGo,
300);
  }

  }

  
function alertMsg(nNum){
   
var _dsp=$("_d_sp");
if(inArr(webgame.arr[webgame.oldseat],webgame.rate)){//12
if(webgame.arr[webgame.oldseat]==webgame.rate[webgame.gamenow]){//11
  var xmlMsg=webgame.xml.selectSingleNode("tra/tda[@seat='"+webgame.arr[webgame.oldseat]+"']");
  
if(xmlMsg !=null)
  
{//2
  var xmlMsgs=xmlMsg.childNodes(webgame["a"+webgame.oldseat]).childNodes(nNum);
    nNum
++;
    
if(xmlMsgs!=null){//4
    var peo=xmlMsgs.getAttribute("sp").replace(/XXX/g,webgame.XX).replace(/OOO/g,webgame.OO);
    
var talks=xmlMsgs.text.replace(/XXX/g,"<font color='greed'>"+webgame.XX+"</font>").replace(/OOO/g,"<font color='greed'>"+webgame.OO+"</font>").replace(/br/g,"<br>");
    _dsp.innerHTML
="<font color='red'>"+peo+"</font>:"+talks+"<div class='dspss' onclick='alertMsg("+nNum+");'>>>></div>";
  _dsp.style.display
="block";
  $(
"zz2").style.display="block";
    }
//4
    else{//4
    _dsp.style.display="none";
  $(
"zz2").style.display="none";
  $(
"areamsg").value+=webgame.ratemsg[webgame.gamenow]+"\n";
    webgame.gamenow
++;
    
//alert(webgame.gamenow);
    if(webgame.gamenow==webgame.gameover){
    
//放烟花
    $("yanhuaf").innerHTML="<embed src='yanhua.swf' quality='high' wmode='transparent' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='550' height='400' id='yanhua_flash'></embed> ";
    }

    }
//4
      }
//2
    }
//11
      else{//11
  _dsp.innerHTML="此处没有发现塞尔的任何踪迹!<div class='dspss' onclick='zz2.style.display=\"none\";_d_sp.style.display=\"none\"'>>>></div>";
    _dsp.style.display
="block";
  $(
"zz2").style.display="block";
  }
//11

}
//12
else{
var sjl=Math.floor(Math.random()*6)+1;
if(sjl<3)
{
webgame.jl
+=sjl;
alert(
"你获得了"+sjl+"个小型月饼");
}

}

  }
//1
  
  
function inArr(str,arrs)
  
{
  
for(var i=0;i<arrs.length;i++)
  
{
  
if(arrs[i]==str){return true;}
  }

  
return false;
  }

  
function callmoon(url){
var request=new Ajax.Request(url,{
                    method: 'get', 
                    onComplete: showResponse                 
                }

);
}
   
function showResponse(response) {
 $(
"_d_sp").innerHTML =response.responseText;
  $(
"_d_sp").style.width="300px";
  webgame.callstimes
=setTimeout(calltimeout,3000)
        }
 
       
function calltimeout()
       
{
       $(
"_d_sp").style.width="450px";
       $(
"_d_sp").innerHTML="<font color='red'>"+webgame.OO+"</font>:"+"这是我照着一张清单做的<div class='dspss' onclick='alertover();'>>>></div>";
       }

       
       
function alertover()
       
{
       window.showModelessDialog(
"makecake.htm","makes","dialogWidth:300px;dialogHeight:500px;status:no");
       $(
"_d_sp").innerHTML="<font color='red'>"+webgame.XX+"</font>:"+"真难看,又难吃!<br>"+"<font color='red'>"+webgame.OO+"</font>:你不喜欢吗?我很用心做的"+"<div class='dspss' onclick='gover();'>>>></div>";
       }

       
function gover()
       
{
       $(
"_d_sp").innerHTML="<input id='R1' checked='checked' name='RR' type='radio' />喜欢<input id='R2' name='RR' type='radio' style='width:200px'/>不喜欢<br>请在下面写下你接着会说的话<br>"+webgame.XX+":<input id='rspeak' type='text' /><br><input id='Button1' type='button' value='确定' onclick='sendcall(R1,rspeak,\"callback.aspx\")'/>";
       }

         
function sendcall(cel,el,url)
         
{
         
var lentime=Math.floor((new Date()-webgame.starts)/1000)
         
var pars="c=" + cel.checked+"&str="+el.value+"&boy="+webgame.OO+"&gril="+webgame.XX+"&bu="+webgame.amount+"&lt="+lentime;
var request=new Ajax.Request(url,{
                    method: 'get',
                    parameters: pars, 
                    onComplete: showResponse1                 
                }

);
}
   
function showResponse1(response) {
$(
"thanks").style.display="block";
 $(
"_d_sp").innerHTML ="<font color='yellow'>恭喜你玩完了此游戏,<br>特赠送你一份礼物:<br>你将有幸在国庆期间与<font color='#0099FF'>"+webgame.OO+"</font>一起度过,并可任意使唤<font color='#0099FF'>"+webgame.OO+"</font></font>";
  $(
"_d_sp").style.width="300px";
  
if(response.responseText !="" && response.responseText !=null)
  
{
  alert(
"Hi!"+response.responseText);
  }

        }
 
       
  webgame.xml
=loadXML("speak.xml");
  webgame.xmllove
=loadXML("moonlove.xml");
  webgame.starts
=new Date();
    
</script>

    
<title>AtomDream-WebGame:寻找塞尔(中秋特别版)</title>

    
<script for="yanhua_flash" event="FSCommand()" language="javascript">
    $(
"yanhuaf").style.display="none";
    $(
"_d_sp").innerHTML="<font color='red'>"+webgame.OO+"</font>:"+"漂亮吗?不仅有好看的,还有好吃的呢<br>看,送给你的!<div class='dspss' onclick='callmoon(\"mooncake.htm\");'>>>></div>";
    $(
"zz2").style.display="block";
    $(
"_d_sp").style.display="block";
    
</script>

</head>
<body onload="loadgame(_d_zz);">
    
<div id="_d_zz" class="zzs">
        
<div id="_d_go" class="gos">
            
<table border="1">
                
<tr>
                    
<td align="center">
                        欢迎参加本次中秋活动
</td>
                
</tr>
                
<tr>
                    
<td>
                        请告诉我你的名字,用于进行排名和抽奖
</td>
                
</tr>
                
<tr>
                    
<td>
                        姓名
<input id="_t_name" type="text" /></td>
                
</tr>
                
<tr>
                    
<td>
                        
<input id="_b_go" type="button" value="立刻开始!" onclick="setname(_t_name);" />
                    
</td>
                
</tr>
            
</table>
            
**特别的名字,也许会有惊喜哦!
        
</div>
    
</div>
    
<div class="pagebody">
        
<div id="_d_title" class="titles">
            AtomDream
        
</div>
        
<div id="_d_map" class="maps">
            
<table id="_t_map" cellpadding="0" cellspacing="0">
            
</table>
        
</div>
        
<div id="_d_menu" class="menus">
            
<div id="_d_sz" class="sz">
                
<div id="_el_sz" class="elsz" onclick="szGo(this);">
                    
<div id="_sz_zz" class="elszss">
                    
</div>
                
</div>
                
<div>
                    
<input id="gofront" name="_r_go" type="radio" checked="checked" />前进<input id="goafter"
                        name
="_r_go" type="radio" />后退</div>
            
</div>
            
<div id="_d_msg" class="msgs">
                
<textarea id="areamsg" cols="25" readonly="readonly" rows="24" class="areamsg">欢迎光临</textarea>
            
</div>
        
</div>
        
<div id="_d_botm" class="botms">
            
<div id="_d_botmsg" class="botmsgs">
            
</div>
            
<div id="_d_botmsgr" class="botmsgrs">
                
<marquee id="marmsg" truespeed="truespeed" direction="left" scrolldelay="150">
                    AtomDream祝你中秋快乐
</marquee>
            
</div>
        
</div>
    
</div>
    
<div id="_d_sp" class="dsps">
    
</div>
    
<div id="zz2" class="zzs" style="display: none;">
    
</div>
    
<div id="yanhuaf" style="display: ; position: absolute; left: 60px; top: 60px;">
    
</div>
    
<div id="thanks" style="display: none;background-color:#828282;border: solid 3px white; position: absolute;z-index:103; left: 500px; top: 60px;">
        本游戏由AtomDream
---塞尔开发<br />
        希望大家有个美好的中秋与国庆
<br />
        特别鸣谢:
<br />
        CCA
---没有他帮忙,就不能在中秋完成此游戏了<br />
        惠州
-佛山的司机-----好在他开车非常稳定,<br />我才可以在车上写好游戏剧情<br />
        
<a href="pai.htm">点击查看所有玩家排名</a>
        
</div>
</body>
</html>
posted on 2007-09-25 13:04  塞尔  阅读(406)  评论(0编辑  收藏  举报