对对碰游戏 VB源程序代码

来源:百度知道 编辑:UC知道 时间:2024/07/05 00:09:13
谢谢!

'在Form中必须有以下控件:
'对对碰图片数组(请自行加入):image1(0)-image1(9)
'当前图片:image2(0) (=image1(0))
'当前关口: lblLevel(label)
'另外label控件还有:lblLink、lblMsg、lblNextScore、lblNowScore、lblScore
'把下面代码复制到Form内即可。

Option Explicit
Dim Rows As Integer
Dim Cols As Integer
Dim Level As Long
Dim Score As Long
Dim picNothing As Image
Dim pic() As Long '图片对应序号
Dim sel() As Boolean '图片被选状态
Dim NowLink() As Long '图片被选后对应序号
Dim High() As Long
Dim selected As Boolean '当前选择状态
Dim col As Long
Dim CountLink As Long

Private Sub Form_Load()
Rows = 10 '总行数
Cols = 10 '总列数
DrawBoxs Image2, 4, 92, Rows, Cols '画控件数组
End Sub

'开始游戏
Private Sub Image3_Click()
AutoRedraw = 0
Image3.Visible = False
init
End Sub

'初始化随机排列物件
Sub init()
Level = 0
Score = 0
lblNowScore = Score
NewLever<