三九宝宝网宝宝教育学龄段教育

求大神指导用vb怎么做打地鼠游戏

03月18日 编辑 39baobao.com

[如何用VB程序设计打地鼠游戏]下面是源代码:Form1: Private Sub Form_Load() Dim temp As Integer Randomize temp = Int(Rnd * 3) + 1 Form1.Picture = LoadPicture("C:\Users\Administrator\Desktop\打地...+阅读

1、控件:Picture1(0~8) 排三列三排Timer1 Interval设为1000Text1 Text 设为0Command1 caption 设为“开始”

2、代码:Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Dim m, i, n As IntegerPrivate Sub Form_Load()Timer1.Enabled = FalseFor l = 0 To 8Picture1(l).Visible = FalseNext lEnd SubPrivate Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Timer1_Timer()If i= 80 Thenm = m + 1c = MsgBox("恭喜你过关了。

你的得分为" Text1 vbCrLf "是否进入" m + 1 "关", 4)If c = vbYes ThenTimer1.Interval = Timer1.Interval - 100 * (11 - m) / 10ElseTimer1.Enabled = FalseEnd IfElseMsgBox "请重新开始!"End Ifn = 0Text1 = 0End Ifn = n + 1End SubPrivate Sub Picture1_Click(Index As Integer)Select Case IndexCase IndexIf Index = i ThenTimer1.Enabled = FalseText1 = Text1 + 10MsgBox "恭喜你!"Timer1.Enabled = TrueEnd IfEnd SelectEnd Sub...

如何用VB程序设计打地鼠游戏

下面是源代码:Form1: Private Sub Form_Load() Dim temp As Integer Randomize temp = Int(Rnd * 3) + 1 Form1.Picture = LoadPicture("C:\Users\Administrator\Desktop\打地鼠\picture" & temp & ".jpg") WindowsMediaPlayer1.URL = "C:\Users\Administrator\Desktop\打地鼠\Heaven's Devils.wma" End Sub Private Sub Label1_Click() Form2.Show Form2.num = -1 Form1.Hide WindowsMediaPlayer1.URL = "" Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '写操作 Close #1 Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2 Close #2 Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3 Close #3 End Sub Private Sub Label2_Click() End End Sub Form2: Dim allnum As Integer, oknum As Integer '定义变化次数 打中次数 Public num As Integer '判别是否第一次开始游戏 Dim flags1 As Boolean '判别文件是否保存 Public flags As Boolean '判别是否播放声音 Private Sub countine_Click() pause.Enabled = True Timer1.Enabled = True countine.Enabled = False WLXZ.Enabled = True End Sub Private Sub exit_Click() Dim X As Integer Dim tt As Integer X = MsgBox("是否真的退出?", vbYesNo, "退出游戏框") If X = 6 Then tt = MsgBox("退出游戏之前,是否保存", vbYesNo, "保存提示") If tt = 6 Then If flags1 = True Then End Else If Timer1.Interval = 1000 Then Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '写操作 Print #1, Text1.Text + " " + Format(Date, "M/d/yy") Close #1 ElseIf Timer1.Interval = 500 Then Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2 Print #2, Text1.Text + " " + Format(Date, "M/d/yy") Close #2 Else Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3 Print #3, Text1.Text + " " + Format(Date, "M/d/yy") Close #3 End If End If End If End End If End Sub Private Sub Form_Load() Form4.Check1.Value = 1 WindowsMediaPlayer1.Controls.stop countine.Enabled = False pause.Enabled = False WLXZ.Enabled = False Form5.Top = Form2.Top + 700 Form5.Left = Form2.Left flags1 = False flags = True End Sub Private Sub help_Click() Form3.Show End Sub Private Sub new_game_Click() num = num + 1 Dim t As Integer If (num >0) Then t = MsgBox("新游戏开始之前,是否保存", vbYesNo, "保存提示") If t = 6 Then flags1 = True If Timer1.Interval = 1000 Then Open "C:\Users\Administrator\Desktop\打地鼠\primary.dat" For Append As #1 '写操作 Print #1, Text1.Text + " " + Format(Date, "M/d/yy") Close #1 ElseIf Timer1.Interval = 500 Then Open "C:\Users\Administrator\Desktop\打地鼠\intermediate.dat" For Append As #2 Print #2, Text1.Text + " " + Format(Date, "M/d/yy") Close #2 Else Open "C:\Users\Administrator\Desktop\打地鼠\advanced.dat" For Append As #3 Print #3, Text1.Text + " " + Format(Date, "M/d/yy") Close #3 End If End If End If Call Form_Load allnum = 0 '变化次数初始为0 oknum = 0 '打中次数初始为0 Timer1.Enabled = True pause.Enabled = True WLXZ.Enabled = True End Sub Private Sub options_Click() Timer1.Enabled = False Form4.Show WLXZ.Enabled = False countine.Enabled = True End Sub Private Sub pause_Click() Dim r, g, b As Integer Timer1.Enabled = False countine.Enabled = True pause.Enabled = False WLXZ.Enabled = False Form5.Top = Form2.Top + 700 Form5.Left = Form2.Left Form5.Show

以下为关联文档:

用VB编写程序设计猜数游戏窗体<pre t="code" l="vb">Dim a As Byte Dim b As Byte '回车次数 Private Sub Command1_Click() Randomize a = Int(Rnd * 100 + 1) Command1.Enabled = False b = 0 End Sub<pre...

大神指导 dota中的英雄巫医怎么玩说说出什么装备详细点顺诅咒是需要施法距离的 近了以后 直接往对方的头上仍就好了 你的大计是需要持续施法的 意思就是 放了大计以后就不能动了 你一动就会打断技能了 装备的话 出 假腿 瓶子(如果你...

造价员试题不会做。求大神指导一二。第1步:抵岸价=到岸价CIF+5项从属费(银、外、关、消、增) (注意:关、消、增计税时不可逆向计算,只能依次计算关税再计算消费税最后计增值)第2步:银=FOB*税率;外、关、增=到岸价CIF*税...

汽车行业市场分析求大神指导急急急以市场换技术是过去30年我国制造业常用的产业政策,有的行业取得成功,有的行业则全军覆没。其关键是自主企业换取技术的速度是否跑得过市场周期。汽车行业自主企业技术提升速度...

LOL求大神指导!蛇女啊 这个玩意你仔细看被动 只要你黄色用回蓝成长还是混搭都可以 就可以支撑你的技能 当然你不是瑞兹 不可能技能放不停 注意控蓝buff 装备基本全错 杀人书这玩意太不靠谱...

求指导:无线路由器 modem怎么用对于你刚刚说的这种情况,modem是可以不用的,直接用无线路由器就OK了 但是你的无线路由器必须支持WIFI连接,手机也一样 要是有一个不支持,那就是白弄 你那个大户网是房东给你的一...

六级100个高频率词汇跪求大神指导 !authentic α.可靠的,可信的 compact α.紧凑的,小巧的 confidential a. 机紧的,秘密的 conservative a. 保守的,传统的 conspicuous a. 显而易见的,引人注目的exclusive a. 独有...

才入手的声美E10没有煲过耳机求大神指导详细方法和煲耳机用的软件煲机法: 下载一个煲机软件 按照以下方式煲。如:漫步者煲箱工具、等。 1、使用正常听音强度三分之一的音量驱动耳机12小时(用100~15000Hz/5s扫频信号更好); 2、使用正常听音强...

PPT线动画怎么做出来的求大神指导 “阶梯状”动画效果可实现你的要求。 对于线的运动最好要选“阶梯状”动画效果。直线的动画就不说了,以折线为例说明用法。 上图是共四条折线1、2、3、4,动画方向如图示。 1...

推荐阅读
图文推荐