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

来源:百度知道    2019/6/13 16:08:05
责任编辑:王强
字体:

好心游戏问答中心有网友提出了一个比较有代表性的问题【如何用VB程序设计打地鼠游戏】,小编觉得可能对其他网友也有帮助,所以将此问答整理出来了,希望对您有帮助。

小编为您搜罗的答案1

下面是源代码:
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

小编为您搜罗的答案2

我有一个制作VB制作RPG游戏的教程,你可以找一下《教你用VB制作RPG游戏》,这是一套完整的教程,不过是做一套比较大的游戏系统,不是小游戏的。里面详细介绍了用VB做出一款角色扮演游戏的方法,也许对你有帮助。

小编为您搜罗的答案3

我有源代码,你要的话加分 来自:求助得到的回答

小编为您搜罗的答案4

我简单说一下打地鼠游戏的设计思想:首先设计几个洞,让洞中随机冒出地鼠
,通过鼠标控制锤子,锤子与地鼠接触,则加分,否则不加分,在规定的时间内,如果分值够了,就过关了,否则失败重来。 本回答被网友采纳

小编为您搜罗的答案5

vb????可以做游戏?第一次听 请注意:本文为编辑制作专题提供的资讯,页面显示的时间仅为生成静态页面时间而非具体内容事件发生的时间,由此给您带来的不便敬请谅解!

相关攻略及问答:

用VB程序设计计算器

问:用VB编程序设计一个简易的计算器。 实验要求: 1. 设计合适的运行界面并...

答:帮你写了一个,调试通过,不过第5个条件很奇怪啊,这样做出来的计算器是不能连续运算的,每次都要按下等号给出结果,程...

如何用VB程序设计编写出1-999之间的水仙花数并打印...

问:1-999之间水仙花数VB程序代码,如何编写?求救?

答:应该是100-999吧 Private Sub Form_Load() Call main1 Call show1 Me.Caption = CStr(allabc(3)) End Sub Function main1() For i = 100 To 999 abc = i aa = CInt(Left(CStr(abc), 1)): bb = CInt(Mid(CStr(abc), 2, 1)): cc = CInt(Right(CStr...

如何用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:\User...

VB程序设计 编写程序,在窗体上打印出 * *** *****...

答:楼上几个都对!尤其笑十三郎的比较好!但是稍微难理解点! 还有个要提醒楼主,要把窗体的AutoReDrew属性改为True!!要不然窗体是不能显示出来的!

vb编程软件怎么打出诗句

答:Private Sub Command1_Click() If Text1.Text = "" Then Exit Sub Dim word As Variant, s As String Dim k As Integer, maxw As String, n As Integer s = Replace(Replace(Text1.Text, ",", " "), ".", " ") s = Replace(Replace(s, ",", " "...

求代码 VB程序设计

答:Private Sub Form_Click() Dim i As Integer, j As Integer For i = 9 To 1 Step -1 Print Spc(5 + i); For j = 1 To (10 - i) * 2 - 1 Print CStr(i); Next Print NextEnd Sub

vb程序设计,求三个数的最大值和最小值,代码怎么...

答:思路,把三个数存放到变量x,y,z,里,然后按照从大到小排列,最后x里是最大值,z里是最小值。 Dim x As Single, y As Single,z As Single Dim t As Single x = Val(InputBox("输入第1个数:")) y = Val(InputBox("输入第2个数:")) z = Val(In...

vb程序设计驱动器如何打开

问:vb程序设计驱动器如何打开

答:Open "d:\89data.txt" For Input As #1 设置绝对路径的时候。 Open App.Path & "\89data.txt" For Input As #1设置相对路径 文件要放在VB工程同一文件夹内!

VB程序设计题:设计窗体程序,输入x,y的值,计算...

问:VB程序设计题:设计窗体程序,输入x,y的值,计算下面数学式子的值,并...

答:vb6Option ExplicitConst e = 2.718281828459Const pi = 3.14159265358979Const d2r = pi / 180#Private Sub Form_Load() Dim x As Double Dim y As Double Dim c1 As Double Dim c2 As Double x = InputBox("输入x(deg):") y = InputBox("输入...

vb程序设计

问:要求随机产生30个0~1000的整数,将其放入一个数组中,然后输出其中的最...

答:这个改成这样 arrN(i) = Int(Rnd * (1000 - 0 + 1) + 0) 就是加个乘法符号

www.haoxyx.com true http://getqq.haoxyx.com/g/790/7902927.html report 8078 好心游戏问答中心有网友提出了一个比较有代表性的问题【如何用VB程序设计打地鼠游戏】,小编觉得可能对其他网友也有帮助,所以将此问答整理出来了,希望对您有帮助。小编为您搜罗的答案1下面是源代码:Form1:PrivateSubForm_Load()DimtempAsIntegerRandomizetemp=Int(Rnd*3)+1Form1.Picture=LoadPicture("C:\Users\Administrator\D
最近关注
首页推荐
热门图片
最新添加资讯
24小时热门资讯
精彩资讯
精彩推荐
热点推荐
真视界
精彩图片
社区精粹
关于本站 | 广告服务 | 手机版 | 商务合作 | 免责申明 | 招聘信息 | 联系我们
Copyright © 2004-2017 haoxyx.com All Rights Reserved. 好心游戏网 版权所有
京ICP备10044368号-1 京公网安备11010802011102号