
正文
打地鼠vb.net 打地鼠游戏教案
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
FC冒险岛4攻略
很多啊打地鼠vb.net,打地鼠vb.net我小时候通关了。知道可以记录密码吧打地鼠vb.net,回家睡觉可以补血,床上面有一排字母,那就是密码 password (*^__^*) 嘻嘻……,可以接着打。主要是为了拿武器~~ 家下面向左走还有恐龙可以骑 至于 攻略,我就复制别人打地鼠vb.net的把 无敌的,要下载个修改器 叫做EC修改器,超好用 截图 采纳吧~~
相关问答
Q1: JAVA出现异常,Exception in thread "main" java.lang.NullPointerException
Shrewmouse初始化出错,
图片初始化错了,可以这样:
Image image = new ImageIcon("graphics/Window2.png").getImage();
Q2: vb用一个按钮如何做出停止和暂停
打地鼠vb.net你运行过程中应该用到了Timer1控制地鼠出现打地鼠vb.net的时间你暂停时把Timer1的Enabled 为 False就可以了。
暂停代码为打地鼠vb.net:
Timer1.Enabled = False
继续运行代码为打地鼠vb.net:
Timer1.Enabled = True
停止你只需要把开始运行的各种函数值重新赋予初始值就可以了。
Q3: VB制作打地鼠游戏
Private Sub CmdStart_click()
nt = Timer
End Sub
同时去掉
Private Sub Form_Load()
nt = Timer
End Sub
Q4: 期末老师让做一个比较有创意的vb.net小软件,无从下手!求帮忙
随手做了个打地鼠,代码拿去吧。
下图是10x10超大窗体“打地鼠”
直接新建个窗体,覆盖全部代码,不需要拖控件,全部动态创建了。
参数都在前面几行,可以随便改。
格子宽和高是70,间距20,因此横格子和竖格子不要超过10,不然窗体会扩张到非常大的程度。
调整时钟的Interval可决定地鼠的出现频率,你可以修改变化概率 = 15这句话改变出现几率。
Public Class Form1
Dim 横格子 = 4
Dim 竖格子 = 4
Dim 背景色 = Color.Bisque
Dim 打中色 = Color.LawnGreen
Dim 失误色 = Color.Red
Dim 按钮(横格子, 竖格子) As Button
Public WithEvents 时钟 As New Timer With {.Interval = 400}
Public WithEvents 分数板 As New Label With {.AutoSize = False, .Width = 120,
.Height = 26}
Dim 字体 = New Font("黑体", 14)
Dim 随机数 As New Random
Dim 打中数 As Integer = 0
Dim 分数 As Integer = 0
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Font = 字体
For x = 1 To 横格子
For y = 1 To 竖格子
按钮(x, y) = New Button()
Me.Controls.Add(按钮(x, y))
按钮(x, y).Width = 70
按钮(x, y).Height = 70
按钮(x, y).Text = ""
按钮(x, y).Location = New Point((x - 1) * (按钮(x, y).Width + 20) +
20, (y - 1) * (按钮(x, y).Height + 20) + 20)
按钮(x, y).Name = String.Format("Button_{0}_{1}", x, y)
按钮(x, y).BackColor = 背景色
按钮(x, y).FlatStyle = FlatStyle.Flat
按钮(x, y).Tag = 0
AddHandler 按钮(x, y).Click, AddressOf 按钮点击
Next
Next
Me.Text = "打地鼠" " [空格键暂停]"
Me.KeyPreview = True
Dim k = 按钮(横格子, 竖格子)
Me.Width = k.Left + k.Width + 40
Me.Height = k.Top + k.Height + 65
Me.Controls.Add(分数板)
分数板.Location = New Point(Me.Width / 2 - 25, 0)
分数板.Text = "分数牌"
时钟.Enabled = True
End Sub
Private Sub 按钮点击(sender As Object, e As EventArgs)
If 时钟.Enabled = False Then Exit Sub
Dim 控件名 = CType(sender, Button).Name.Split("_")
Dim x = CInt(控件名(1)) '截取_分割的第二部分Button_{0}_{1}
Dim y = CInt(控件名(2)) '截取_分割的第三部分Button_{0}_{1}
If 按钮(x, y) IsNot Nothing Then
If 按钮(x, y).Text = "地鼠" Then
打中数 = 打中数 + 1
分数 = 分数 + 20
按钮(x, y).Text = 打中数 "!"
分数板.Text = "得分:" 分数
按钮(x, y).BackColor = 打中色
按钮(x, y).Tag = 1
ElseIf 按钮(x, y).Text = "" Then
分数 = 分数 - 20
If 分数 0 Then 分数 = 0
分数板.Text = "得分:" 分数
按钮(x, y).Text = "乱打!"
按钮(x, y).BackColor = 失误色
按钮(x, y).Tag = 2
End If
End If
End Sub
Private Sub 时钟_Tick(sender As Object, e As EventArgs) Handles 时钟.Tick
For x = 1 To 横格子
For y = 1 To 竖格子
Dim 变化概率 = 随机数.Next(1, 100)
If 变化概率 = 40 Then
If 按钮(x, y).Tag = 1 Or 按钮(x, y).Tag = 2 Then
按钮(x, y).Text = ""
按钮(x, y).BackColor = 背景色
按钮(x, y).Tag = 0
End If
End If
If 变化概率 = 15 Then
If 按钮(x, y).Text = "地鼠" Then
按钮(x, y).Text = ""
ElseIf 按钮(x, y).Text = "" Then
按钮(x, y).Text = "地鼠"
End If
End If
Next
Next
End Sub
Private Sub Form1_KeyUp(sender As Object, e As KeyEventArgs) Handles
MyBase.KeyUp
If e.KeyCode = Keys.Space Then 时钟.Enabled = Not 时钟.Enabled
End Sub
End Class
如满意,请采纳,谢谢。
Q5: 大神快来 如何使用vb制作一个简单的打地鼠游戏?最好用教程
1、控件:
picture1(0~8)
排三列三排
timer1
interval设为1000
text1
text
设为0
command1
caption
设为“开始”
2、代码:
private
declare
sub
sleep
lib
"kernel32"
(byval
dwmilliseconds
as
long)
dim
m,
i,
n
as
integer
private
sub
form_load()
timer1.enabled
=
false
for
l
=
to
8
picture1(l).visible
=
false
next
l
end
sub
private
sub
command1_click()
timer1.enabled
=
true
end
sub
private
sub
timer1_timer()
if
i
9
then
picture1(i).visible
=
false
end
if
randomize
i
=
(rnd()
*
8)
mod
10
picture1(i).visible
=
true
picture1(i).zorder
if
n
=
10
then
picture1(i).visible
=
false
if
text1
=
80
then
m
=
m
+
1
c
=
msgbox("恭喜你过关了。你的得分为"
text1
vbcrlf
"是否进入"
m
+
1
"关",
4)
if
c
=
vbyes
then
timer1.interval
=
timer1.interval
-
100
*
(11
-
m)
/
10
else
timer1.enabled
=
false
end
if
else
msgbox
"请重新开始!"
end
if
n
=
text1
=
end
if
n
=
n
+
1
end
sub
private
sub
picture1_click(index
as
integer)
select
case
index
case
index
if
index
=
i
then
timer1.enabled
=
false
text1
=
text1
+
10
msgbox
"恭喜你!"
timer1.enabled
=
true
end
if
end
select
end
sub
关于打地鼠vb.net和打地鼠游戏教案的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。





