视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
用vbs实现的连连看在线游戏_javascript技巧
2020-11-27 20:39:37 责编:小采
文档


在线演示



连连看_www.gxlcms.com_脚本之家










连连看游戏:将两个相同格子连接起来就会消失,看谁连的快,限时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>






dim x,y
dim clickId
dim obj1,obj2,Flag1
dim Num1,Num2
dim mytime
dim Myrnd
dim x1,y1,x2,y2
Flag1=0
dim NumArray(10,17)
dim QuanArray(10,17)
dim LuJArray(10,17)
dim RTN,RTN1,RTN2
dim totalNum,lastNum
lastNum=0

'初始化数字数组开始
for x=0 to 10
for y=0 to 17
numArray(x,y)=0
QuanArray(x,y)=0
next
next
'初始化数字数组结束

for x=1 to 9
for y=1 to 16
window.execScript "td_" & X & "_" & y & ".innerText =" & chr(34) & "0" & chr(34),"vbs"
next
next

'随便放些数字开始
do
randomize
RndX=cint(rnd*9)+1
randomize
Rndy=cint(rnd*16)+1
randomize
Myrnd=cint(rnd*30)+1
window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText","vbs"

if lastNum="0" then
window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs"
NumArray(RndX,Rndy)=Myrnd
totalNum=totalNum+1
do
randomize
RndX=cint(rnd*9)+1
randomize
Rndy=cint(rnd*16)+1
window.execScript "lastNum=td_" & RndX & "_" & Rndy & ".innerText"
if lastNum="0" then
window.execScript "td_" & RndX & "_" & Rndy & ".innerText =" & Myrnd,"vbs"
NumArray(RndX,Rndy)=Myrnd
totalNum=totalNum+1
exit do
end if
loop
end if
if totalNum=16*9 then exit do'如果生成了全部数字,那么退出
loop
'随便放些数字结束

sub aaa(obj)
for x=0 to 10
for y=0 to 17
QuanArray(x,y)=0
next
next
if obj1=obj.id then exit sub '如果选择还是相同那么认为没选,跳出本过程

Flag1=Flag1+1
Flag1=Flag1 mod 3
RTN=fase
select case Flag1
case 0'什么也没选

case 1
obj1=obj.id
Num1=obj.innerText
obj.bordercolor="#ff0000"
temarray=split(obj1,"_")
x1=cint(temarray(1))
y1=cint(temarray(2))
case 2
obj2=obj.id
Num2=obj.innerText
obj.bordercolor="#ff0000"
temarray=split(obj2,"_")
x2=cint(temarray(1))
y2=cint(temarray(2))
if Num1=Num2 then
RTN1=CheckLink(x1,y1,x2,y2)

if RTN1=true then
Dispear x1,y1,x2,y2
Flag1=0
else
'恢复
Flag1=0
window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
end if
else
'恢复
Flag1=0

window.execScript "td_" & x1 & "_" & y1 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"
window.execScript "td_" & x2 & "_" & y2 & ".bordercolor =" & chr(34) & "#00FF66" & chr(34),"vbs"


end if
end select


end sub


function CheckLink(xx1,yy1,xx2,yy2)
RTN=false
for x=0 to 10
for y=0 to 17
QuanArray(x,y)=0
next
next
QuanArray(xx1,yy1)=1
RTN2=gogogogo(xx1,yy1)
CheckLink= RTN

end function

function gogogogo(xx,yy)
'vartype(xx) & "!"& xx & "-" & yy & "*" & vartype(x2) & " !" & x2 & "-" & y2
'msgbox xx & "-" & yy
'if xx<=10 and xx>=0 and yy<=17 and yy>=0 then
'window.execScript "td_" & xx & "_" & yy & ".innertext =" & chr(34) & "#" & chr(34),"vbs"
'window.execScript "td_" & xx & "_" & yy & ".bordercolor =" & chr(34) & "#0000ff" & chr(34),"vbs"
'end if
if vartype(xx)<>2 then xx=cint(xx)
if vartype(yy)<>2 then yy=cint(yy)
if vartype(x2)<>2 then x2=cint(x2)
if vartype(y2)<>2 then y2=cint(y2)

if RTN=true then
gogogogo=true
exit function
end if
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'先判断四周是不是
'连到了的选项
gogogogo=true
RTN=true
exit function
else'这里是已经判断了四周不是

'向下开始
if xx+1<=10 then'是否碰壁
if not(xx+1=x2 and yy =y2) then'是否连到了
if numArray(xx+1,yy)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!
if (xx+2 =x2 and yy=y2) or (xx+1 =x2 and yy+1=y2) or (xx+1 =x2 and yy-1=y2) then
'连到了的选项

gogogogo=true
RTN=true

exit function
else
'这里是空地但是还没连上目标mm
if QuanArray(xx+1,yy)=0 then'是否已经来过此地
'连通空地,继续走继续朝前走的选项
QuanArray(xx+1,yy)=1'撒尿标记:老孙从这个方向到此一游!
RTN2=gogogogo(xx+1,yy)'继续去取经
else
'来过了
end if
end if
else
'碰到了别的图片,和碰壁查不多
end if
else
'连到了的选项
gogogogo=true
RTN=true
exit function
end if
else
'碰壁了
end if
'向下结束
'向上开始
if xx-1>=0 then'是否碰壁
if not(xx-1=x2 and yy=y2) then '是否连到了
if numArray(xx-1,yy)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!
if (xx-2 =x2 and yy=y2) or (xx-1 =x2 and yy+1=y2) or (xx-1 =x2 and yy-1=y2) then
'连到了的选项

gogogogo=true
RTN=true

exit function
else
'这里是空地但是还没连上目标mm
if QuanArray(xx-1,yy)=0 then'是否已经来过此地
'连通空地,继续走继续朝前走的选项
QuanArray(xx-1,yy)=2'撒尿标记:老孙从这个方向到此一游!
RTN2=gogogogo(xx-1,yy)'继续去取经
else
'来过了
end if
end if
else
'碰到了别的图片,和碰壁查不多
end if
else
'连到了的选项
gogogogo=true
RTN=true
exit function
end if
else
'碰壁了
end if
'向上结束
'向左开始
if yy-1>=0 then'是否碰壁
if not(yy-1=y2 and xx=x2) then '是否连到了
if numArray(xx,yy-1)=0 then '是否碰到了别的图片
'这里是空地,如果空地的其余三面连接目标图片,那么就结束了,ok!

下载本文
显示全文
专题