欢迎来到天天文库
浏览记录
ID:9946074
大小:132.50 KB
页数:20页
时间:2018-05-16
《vb俄罗斯方块代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、经典俄罗斯方块演示:代码如下:DimType_NowAsInteger'目前方块的类型DimType_NextAsInteger'下个方块的类型DimintRotateAsInteger'方块旋转的状态FunctionGet_X_Value()IfGetValue(1,2)Then'GetXValueIfMaxX-MinX>=2ThenIfMaxX-CurX<=1ThenAdjust_Left=MaxX-2-1ElseAdjust_Left=CurX-1EndIfGet_X_Value=TrueE
2、xitFunctionEndIfEndIfGet_X_Value=FalseEndFunctionFunctionGetValue(nTypeAsInteger,nWidAsInteger)CallGetCoorOnErrorResumeNextDimOKCount,EmptyCountAsIntegerMinX=Xs(1).cXMaxX=Xs(1).cXMinY=Xs(1).cYMaxY=Xs(1).cYFori=2To4IfMinX>Xs(i).cXThenMinX=Xs(i).cXIfMax
3、XXs(i).cYThenMinY=Xs(i).cYIfMaxY4、nWid-1)Step-1Forj=MinXToMaxXIfTotal(j,i)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMinY=MinY-EmptyCountIfMinY<1ThenMinY=1EmptyCount=0'GetMaxYOKCo5、unt=0Fori=MaxY+1ToMaxY+nWid-1Forj=MinXToMaxXIfTotal(j,i)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMaxY=MaxY+EmptyCountIfMaxY>20ThenMaxY=20Else'G6、etXValueEmptyCount=0'GetMinXOKCount=0Fori=MinX-1ToMinX-(nWid-1)Step-1Forj=MinYToMaxYIfTotal(i,j)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMinX=M7、inX-EmptyCountIfMinX<1ThenMinX=1EmptyCount=0'GetMaxXOKCount=0Fori=MaxX+1ToMaxX+(nWid-1)Forj=MinYToMaxYIfTotal(i,j)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExit8、ForEndIfNextMaxX=MaxX+EmptyCountIfMaxX>10ThenMaxX=10EndIfGetValue=TrueEndFunctionFunctionGet_Y_Value()IfGetValue(0,2)Then'GetYValueIfMaxY-MinY>=2ThenIfMaxY-(picPictureNow.Top+1)<=1ThenAdjust_Top=MinY-1ElseAdjust_Top=picPictureNow.TopEndIfGet_Y
4、nWid-1)Step-1Forj=MinXToMaxXIfTotal(j,i)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMinY=MinY-EmptyCountIfMinY<1ThenMinY=1EmptyCount=0'GetMaxYOKCo
5、unt=0Fori=MaxY+1ToMaxY+nWid-1Forj=MinXToMaxXIfTotal(j,i)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMaxY=MaxY+EmptyCountIfMaxY>20ThenMaxY=20Else'G
6、etXValueEmptyCount=0'GetMinXOKCount=0Fori=MinX-1ToMinX-(nWid-1)Step-1Forj=MinYToMaxYIfTotal(i,j)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExitForEndIfNextMinX=M
7、inX-EmptyCountIfMinX<1ThenMinX=1EmptyCount=0'GetMaxXOKCount=0Fori=MaxX+1ToMaxX+(nWid-1)Forj=MinYToMaxYIfTotal(i,j)=FalseThenOKCount=OKCount+1NextIfOKCount>=picPictureNow.WidthAndOKCount>=picPictureNow.HeightThenEmptyCount=EmptyCount+1OKCount=0ElseExit
8、ForEndIfNextMaxX=MaxX+EmptyCountIfMaxX>10ThenMaxX=10EndIfGetValue=TrueEndFunctionFunctionGet_Y_Value()IfGetValue(0,2)Then'GetYValueIfMaxY-MinY>=2ThenIfMaxY-(picPictureNow.Top+1)<=1ThenAdjust_Top=MinY-1ElseAdjust_Top=picPictureNow.TopEndIfGet_Y
此文档下载收益归作者所有