| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 707 人关注过本帖
标题:赛跑游戏
取消只看楼主 加入收藏
jyp19851119
Rank: 1
等 级:新手上路
帖 子:157
专家分:0
注 册:2008-2-26
结帖率:100%
收藏
 问题点数:0 回复次数:1 
赛跑游戏
我就这水平,见笑了

赛跑.rar (13.67 KB)
搜索更多相关主题的帖子: 游戏 赛跑 
2008-11-23 15:32
jyp19851119
Rank: 1
等 级:新手上路
帖 子:157
专家分:0
注 册:2008-2-26
收藏
得分:0 
代码
Option Explicit
Dim Money, Index1, Cen, Finish


Private Sub Command1_Click()
Dim i
If Option1(0).Value = False And Option1(1).Value = False Then
   MsgBox "您还没有选择选手!", , "提示"
Else
   Timer1.Enabled = True
   Command1.Enabled = False
   Money = Money - 20: Label2.Caption = Money
   Do
   Index1 = CInt(Rnd * 1)
   Cen = CInt(Rnd * 20) + 20
   Image1(Index1).Move Image1(Index1).Left + Cen
   Delay (10)
   Loop Until Image1(Index1).Left + Image1(Index1).Width > Finish
   If Option1(Index1).Value = True Then
   MsgBox "你赢了"
   Money = Money + 60
   Label2.Caption = Money
   Else
   MsgBox "你输了"
   End If
   If Money = 0 Then
   MsgBox "你没有赌注了"
   Else
   Command1.Enabled = True
   End If
   For i = 0 To 1
   Image1(i).Left = 1200
   Next i
   For i = 0 To 1
   Option1(i).Value = False
   Next i
   Timer1.Enabled = False

End If
End Sub

Private Sub Form_Load()
Dim i
Timer1.Enabled = False
Image2.Visible = False
Image3.Visible = False
For i = 0 To 1
Option1(i).Value = False
Next i
Money = 100
Label2.Caption = Money
Finish = 8000
End Sub

Private Sub Timer1_Timer()
Static Flag As Integer
If Flag - 2 = 0 Then Flag = 0
If Flag = 0 Then Image1(1).Picture = Image2.Picture
If Flag = 1 Then Image1(1).Picture = Image3.Picture
Flag = Flag + 1
End Sub

Public Sub Delay(X As Long)
  On Error Resume Next
          Dim TStart As Single
          TStart = Timer
          While (Timer - TStart) < (X / 1000)
                  DoEvents
          Wend
End Sub
2008-11-24 08:53
快速回复:赛跑游戏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017702 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved