首頁 >web前端 >js教程 >用vbs实现的连连看在线游戏_javascript技巧

用vbs实现的连连看在线游戏_javascript技巧

WBOY
WBOY原創
2016-05-16 19:02:271433瀏覽

在线演示
nbsp;HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


连连看_www.jb51.net_脚本之家








  
  
    
连连看游戏:将两个相同格子连接起来就会消失,看谁连的快,限时10分钟!


align=center border=1>
  
  
    
    


  
  
    
    
    
用时:  

border=1>
  
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
      
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>
    height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>     height=40>




<script> <BR><!-- <br><br>dim x,y <BR>dim clickId <BR>dim obj1,obj2,Flag1 <BR>dim Num1,Num2 <BR>dim mytime <BR>dim Myrnd <BR>dim x1,y1,x2,y2 <BR>Flag1=0 <BR>dim NumArray(10,17) <BR>dim QuanArray(10,17) <BR>dim LuJArray(10,17) <BR>dim RTN,RTN1,RTN2 <BR>dim totalNum,lastNum <BR>lastNum=0 <br><br> '初始化数字数组开始 <BR> for x=0 to 10 <BR> for y=0 to 17 <BR> numArray(x,y)=0 <BR> QuanArray(x,y)=0 <BR> next <BR> next <BR> '初始化数字数组结束 <br><br> for x=1 to 9 <BR> for y=1 to 16 <BR> window.execScript "td_" & X & "_" & y & ".innerText =" & chr(34) & "0" & chr(34),"vbs" <BR> next <BR> next <br><br>'随便放些数字开始 <BR> do <BR> randomize <BR> RndX=cint(rnd*9)+1 <BR> randomize <BR> Rndy=cint(rnd*16)+1 <BR> randomize <BR> Myrnd=cint(rnd*30)+1 <BR> window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText","vbs" <br><br> if lastNum="0" then <BR> window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs" <BR> NumArray(RndX,Rndy)=Myrnd <BR> totalNum=totalNum+1 <BR> do <BR> randomize <BR> RndX=cint(rnd*9)+1 <BR> randomize <BR> Rndy=cint(rnd*16)+1 <BR> window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText" <BR> if lastNum="0" then <BR> window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs" <BR> NumArray(RndX,Rndy)=Myrnd <BR> totalNum=totalNum+1 <BR> exit do <BR> end if <BR> loop <BR> end if <BR> if totalNum=16*9 then exit do'如果生成了全部数字,那么退出 <BR> loop <BR>'随便放些数字结束 <br><br>sub aaa(obj) <BR> for x=0 to 10 <BR> for y=0 to 17 <BR> QuanArray(x,y)=0 <BR> next <BR> next <BR> if obj1=obj.id then exit sub '如果选择还是相同那么认为没选,跳出本过程 <br><br> Flag1=Flag1+1 <BR> Flag1=Flag1 mod 3 <BR> RTN=fase <BR> select case Flag1 <BR> case 0'什么也没选 <br><br> case 1 <BR> obj1=obj.id <BR> Num1=obj.innerText <BR> obj.bordercolor="#ff0000" <BR> temarray=split(obj1,"_") <BR> x1=cint(temarray(1)) <BR> y1=cint(temarray(2)) <BR> case 2 <BR> obj2=obj.id <BR> Num2=obj.innerText <BR> obj.bordercolor="#ff0000" <BR> temarray=split(obj2,"_") <BR> x2=cint(temarray(1)) <BR> y2=cint(temarray(2)) <BR> if Num1=Num2 then <BR> RTN1=CheckLink(x1,y1,x2,y2) <br><br> if RTN1=true then <BR> Dispear x1,y1,x2,y2 <BR> Flag1=0 <BR> else <BR> '恢复 <BR> Flag1=0 <BR> window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs" <BR> window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs" <BR> end if <BR> else <BR> '恢复 <BR> Flag1=0 <br><br> window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs" <BR> window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs" <br><br> <BR> end if <BR> end select <br><br> <BR>end sub <br><br><BR>function CheckLink(xx1,yy1,xx2,yy2) <BR>RTN=false <BR> for x=0 to 10 <BR> for y=0 to 17 <BR> QuanArray(x,y)=0 <BR> next <BR> next <BR> QuanArray(xx1,yy1)=1 <BR> RTN2=gogogogo(xx1,yy1) <BR> CheckLink= RTN <br><br>end function <br><br>function gogogogo(xx,yy) <BR>'vartype(xx) & "!"& xx & "-" & yy & "*" & vartype(x2) & " !" & x2 & "-" & y2 <BR>'msgbox xx & "-" & yy <BR>'if xx<=10 and xx>=0 and yy<=17 and yy>=0 then <BR> 'window.execScript "td_" & xx & "_" & yy & ".innertext =" & chr(34) & "#" & chr(34),"vbs" <BR> 'window.execScript "td_" & xx & "_" & yy & ".bordercolor =" & chr(34) & "#0000ff" & chr(34),"vbs" <BR>'end if <BR>if vartype(xx)<>2 then xx=cint(xx) <BR>if vartype(yy)<>2 then yy=cint(yy) <BR>if vartype(x2)<>2 then x2=cint(x2) <BR>if vartype(y2)<>2 then y2=cint(y2) <br><br>if RTN=true then <BR> gogogogo=true <BR> exit function <BR>end if <BR>if (xx+1=x2 and yy =y2) or (xx-1=x2 and yy=y2) or (yy+1=y2 and xx=x2) or (yy-1=y2 and xx=x2) then'先判断四周是不是 <BR> '连到了的选项 <BR> gogogogo=true <BR> RTN=true <BR> exit function <BR>else'这里是已经判断了四周不是 <br><br> '向下开始 <BR> if xx+1<=10 then'是否碰壁 <BR> if not(xx+1=x2 and yy =y2) then'是否连到了 <BR> if numArray(xx+1,yy)=0 then '是否碰到了别的图片 <BR> '这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok! <BR> if (xx+2 =x2 and yy=y2) or (xx+1 =x2 and yy+1=y2) or (xx+1 =x2 and yy-1=y2) then <BR> '连到了的选项 <br><br> gogogogo=true <BR> RTN=true <br><br> exit function <BR> else <BR> '这里是空地但是还没连上目标mm <BR> if QuanArray(xx+1,yy)=0 then'是否已经来过此地 <BR> '连通空地,继续走继续朝前走的选项 <BR> QuanArray(xx+1,yy)=1'撒尿标记:老孙从这个方向到此一游! <BR> RTN2=gogogogo(xx+1,yy)'继续去取经 <BR> else <BR> '来过了 <BR> end if <BR> end if <BR> else <BR> '碰到了别的图片,和碰壁查不多 <BR> end if <BR> else <BR> '连到了的选项 <BR> gogogogo=true <BR> RTN=true <BR> exit function <BR> end if <BR> else <BR> '碰壁了 <BR> end if <BR> '向下结束 <BR> '向上开始 <BR> if xx-1>=0 then'是否碰壁 <BR> if not(xx-1=x2 and yy=y2) then '是否连到了 <BR> if numArray(xx-1,yy)=0 then '是否碰到了别的图片 <BR> '这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok! <BR> if (xx-2 =x2 and yy=y2) or (xx-1 =x2 and yy+1=y2) or (xx-1 =x2 and yy-1=y2) then <BR> '连到了的选项 <br><br> gogogogo=true <BR> RTN=true <br><br> exit function <BR> else <BR> '这里是空地但是还没连上目标mm <BR> if QuanArray(xx-1,yy)=0 then'是否已经来过此地 <BR> '连通空地,继续走继续朝前走的选项 <BR> QuanArray(xx-1,yy)=2'撒尿标记:老孙从这个方向到此一游! <BR> RTN2=gogogogo(xx-1,yy)'继续去取经 <BR> else <BR> '来过了 <BR> end if <BR> end if <BR> else <BR> '碰到了别的图片,和碰壁查不多 <BR> end if <BR> else <BR> '连到了的选项 <BR> gogogogo=true <BR> RTN=true <BR> exit function <BR> end if <BR> else <BR> '碰壁了 <BR> end if <BR> '向上结束 <BR> '向左开始 <BR> if yy-1>=0 then'是否碰壁 <BR> if not(yy-1=y2 and xx=x2) then '是否连到了 <BR> if numArray(xx,yy-1)=0 then '是否碰到了别的图片 <BR> '这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok! <BR> </script>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn