标题:asp拼图游戏
摘要: 这个根据jsp的那个拼图游戏思路改写的一个asp拼图
难度:
作者:吕海鹏
来自:it学习网原创
更新日志:
参考文档:
致谢:
讨论网址: http://bbs.deepteach.com
标签(Tags):asp拼图游戏
摘要: 这个根据jsp的那个拼图游戏思路改写的一个asp拼图
难度:
这个根据jsp的那个拼图游戏思路改写的一个asp拼图,
代码如下:
<div align="center"><h1>排字游戏(拼图游戏)</h1></div> <a href="pinzi.asp">开始新游戏</a> <hr /> <% action=request.Querystring("action") ’通过action参数来选择要调用的游戏函数 If action="" Or action="start" then Call start() ’调用 开始函数 End If If action="see" Then Call see() ’调用 显示函数 End if If action="move" Then Call move() ’调用 处理函数 End If %> <% ’======游戏初始化函数================================= Sub start() Dim ges(3,3) shu=0 Randomize ’Randomize 是随机初始化,使用rnd之前必须要先来一句Randomize for h=0 To 2 for l=0 To 2 ges(h,l)=shu shu=shu+1 next next For ci=0 To 10 h1=Int (3*Rnd()) l1=Int (3*Rnd()) h2=Int (3*Rnd()) l2=Int (3*Rnd()) linshi=ges(h1,l1) ges(h1,l1)=ges(h2,l2) ges(h2,l2)=linshi next session("ges")=ges response.Redirect("?action=see") End Sub ’======游戏界面显示函数================================= Sub see() %> <% ’dim ges(3,3) ges=session("ges") %> <table width="300" align="center" border="1" height="300"> <% for h=0 to 2 %> <tr> <% for l=0 To 2 %> <td align="center" onmouseover="this.bgColor=’#CCFFFF’" onmouseout="this.bgColor=’#ffffff’ "> <% if (ges(h,l)<>0) then %> <a href="?h=<%=h%>&l=<%=l%>&action=move"> <h1><%=ges(h,l)%></h1> </a> <% else %> <%End if%> </td> <% next %> </tr> <% next %> </table> <% End Sub ’======游戏处理函数================================= Sub move() %> <% ’Dim ges(3,3) ges=session("ges") h=request.Querystring("h") l=request.Querystring("l") if (h>0) Then If (ges(h-1,l)=0) then ges(h-1,l)=ges(h,l) ges(h,l)=0 End if End if if (h<2 and ges(h+1,l)=0) then ges(h+1,l)=ges(h,l) ges(h,l)=0 End if if (l>0) then if (ges(h,l-1)=0) then ges(h,l-1)=ges(h,l) ges(h,l)=0 End if End If if (l<2 and ges(h,l+1)=0) then ges(h,l+1)=ges(h,l) ges(h,l)=0 End If session("ges")=ges response.Redirect("?action=see") %> <% End sub %> <div align="center"> <hr /> <br /> <iframe id="baiduframe" border="0" vspace="0" hspace="0" marginwidth="0" marginheight="0" framespacing="0" frameborder="0" scrolling="no" width="468" height="40" src="http://unstat.baidu.com/bdun.bsc?tn=advert&cv=1&cid=136707&csid=107&rkcs=4&bgcr=FFFFFF&ftcr=0000CC&rk=1&bd=0&tbsz=&tbst=&bdas=0"></iframe> <br />Copyright© 2005-2008 <a href=’http://www.DeepTeach.com’>深度开发</a> <script language="JavaScript" type="text/javascript" src="http://w.50bang.com/click.js?user_id=142235&l=602"></script> <div style="display:none"> <script language="JavaScript" type="text/javascript" src="http://union1.50bang.com/click.js?user_id=503659&l=901" charset="gb2312"></script> </div> <br />站长: 吕海鹏 <br />程序开发: <a href="http://www.itstudy.cn/" target="_blank">吕海鹏</a> </div> |
作者:吕海鹏
来自:it学习网原创
更新日志:
参考文档:
致谢:
讨论网址: http://bbs.deepteach.com
标签(Tags):asp拼图游戏