这个一个打地鼠的游戏,代码如下:(谁能帮我看看,现在整个能运行了,但是窗体显示的却没有地鼠,请高手指导,我到底哪错了?)

zhecaishiwo 2003-12-09 03:53:18
这个一个打地鼠的游戏,代码如下:(谁能帮我看看,现在整个能运行了,但是窗体显示的却没有地鼠,请高手指导,我到底哪错了?)
Dim 鼠x As Single
Dim 鼠y As Single
Dim 鼠 As Byte
Dim 对数 As Integer
Dim 总数 As Integer
Sub 判断(x, y)
Select Case 地鼠
Case 0, 1, 2
x = 地鼠
y = 0
Case 3, 4, 5
x = 地鼠 - 3
y = 1
Case 6, 7, 8
x = 地鼠 - 3
y = 1
Case 6, 7, 8
x = 地鼠 - 6
y = 2
End Select
End Sub
Private Sub form1_load()
Randomize
Show
Print
For 地鼠 = 0 To 8
判断 x, y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * x, 1000 + 1050 * y
Next
总数 = 1

End Sub

Private Sub form_mouse(botton As Integer, shift As Integer, x As Single, y As Single)

Image1.Move x - Image1.Width / 2, y - Image1.Height / 2

鼠 x = Image1.Left

鼠 y = Image2.Top
Timer1.Enabled = True
Label2.Caption = "运行中..."
End Sub
Private Sub image1_mousedown(botton As Integer, shift As Integer, x As Single, y As Single)
Image1.Picture = Image3.Picture
xy = 99
If 鼠x > 800 And 鼠x < 1850 Then
If 鼠y + 1500 > 1600 And 鼠y + 1500 < 2350 Then xy = 0

If 鼠y + 1500 > 2650 And 鼠y + 1500 < 3400 Then xy = 3

If 鼠y + 1500 > 3700 And 鼠y + 1500 < 4450 Then xy = 6


End If
If 鼠x > 1850 And 鼠x < 2900 Then
If 鼠y + 1500 > 1600 And 鼠y + 1500 < 2350 Then xy = 1

If 鼠y + 1500 > 2650 And 鼠y + 1500 < 3400 Then xy = 4

If 鼠y + 1500 > 3700 And 鼠y + 1500 < 4450 Then xy = 7
End If
If 鼠x > 2900 And 鼠x < 3950 Then
If 鼠y + 1500 > 1600 And 鼠y + 1500 < 2350 Then xy = 2

If 鼠y + 1500 > 2650 And 鼠y + 1500 < 3400 Then xy = 5

If 鼠y + 1500 > 3700 And 鼠y + 1500 < 4450 Then xy = 8
End If
If 地鼠 = xy Then
对数 = 对数 + 1
Label1.Caption = "打中次数 :“ & 对数"
判断 x, y
Form1.PaintPicture Image6, Picture, 1000 + 1050 * x, 1000 + 1050 * y
End If

End Sub

Private Sub image1_mouse(button As Integer, shift As Integer, x As Single, y As Single)

Image1.Move 鼠x - (Image1.Width / 2 - x), 鼠y - (Image1.Height / 2 - y)
鼠x = Image1.Left

鼠y = Image1.Top
End Sub

Private Sub image1_mouseup(botton As Integer, shift As Integer, x As Single, y As Single)
Image1.Picture = Image2.Picture

End Sub

Private Sub timer1_timer()
总数 = 总数 + 1
判断x , y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * x, 1000 + 1050 * y
地鼠 = Int(Rnd * 9)
判断 x, y
Form1.PaintPicture imge4.Picture, 1000 + 1050 * x, 1000 + 1050 * y
If 总数 > 100 Then
Timer1.Enabled = False
判断 x, y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * x, 1000 + 1050 * y
If 对数 > 100 Then
msg = MsgBox("恭喜" + Chr(13) + "您已经爆机了,还要继续吗?", vbYesNo, "地鼠娱乐部")
Else
msg = MsgBox("您已经过关了,您打中了" & 对数 & "次.还要继续吗?", vbYesNo, "地鼠娱乐部")
End If
If msg = vbYes Then
总数 = 1
对数 = 0
Timer1.Enabled = True
Else
Unload Me
End If
End If


Private Sub 退出_click(index As Integer)
End
End Sub

Private Sub 关于_click()
MsgBox "地鼠娱乐部" + Chr(13) + Chr(13) + "这是一个基于windows98以上操作系统下" + Chr(13) + "用VB编写的程序", , "地鼠娱乐部"


End Sub
Private Sub 使用_click()
MsgBox "欢迎来到地鼠娱乐部", Chr(13) + "使用说明:" + Chr(13) + "鼠标左右键都可打击" + "想要能更快地打中地鼠,连续左右键," + Chr(13) + "这样能加快打地鼠的次数", , "地鼠娱乐部"
End Sub
...全文
227 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
vbcainiao 2004-03-26
  • 打赏
  • 举报
回复
哪个有这个源代码啊,这个代码有错误啊
xmzorro 2003-12-16
  • 打赏
  • 举报
回复
到这里给分吧!
http://expert.csdn.net/Expert/TopicView2.asp?id=2544849&datebasetype=now
sysmaster 2003-12-15
  • 打赏
  • 举报
回复
在VB中可以用中文名,不过以后程序的可移植性就不高了!
zhecaishiwo 2003-12-15
  • 打赏
  • 举报
回复
对,对,中文怎么了?能运行出来最重要,这里的部分人很横的,我不敢惹,他们都是高手.
zmrok 2003-12-13
  • 打赏
  • 举报
回复
楼上的,谁说不可用中文做变量?请不要戴有色眼镜看,好不好!
zhecaishiwo 2003-12-13
  • 打赏
  • 举报
回复
我刚到这个BBS,不懂这的情况,怎么样才能给你分,为什么这么多人都要分呢?分高能做什么?

能告诉我吗?
xmzorro 2003-12-12
  • 打赏
  • 举报
回复
怎么不给分数?
ucme 2003-12-10
  • 打赏
  • 举报
回复
建议你去用易语言,你的代码真的贻笑大方啊,哪有人用中文做变量的
zhecaishiwo 2003-12-10
  • 打赏
  • 举报
回复
谢谢,你的程序,我去试试.
xmzorro 2003-12-09
  • 打赏
  • 举报
回复
完全版:希望对你有帮助!
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
BackColor = &H00004080&
BorderStyle = 1 'Fixed Single
Caption = "地鼠娱乐部"
ClientHeight = 5055
ClientLeft = 150
ClientTop = 435
ClientWidth = 5610
ClipControls = 0 'False
FillColor = &H00008000&
BeginProperty Font
Name = "楷体_GB2312"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Icon = "地鼠娱乐部1.0.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5055
ScaleWidth = 5610
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 700
Left = 90
Top = 585
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "鼠标进入画面开始"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 285
Left = 2835
TabIndex = 1
Top = 4680
Width = 2715
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = "得分"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 345
Left = 45
TabIndex = 0
Top = 120
Width = 2280
End
Begin VB.Image Image6
Height = 1050
Left = 2280
Picture = "地鼠娱乐部1.0.frx":7BBA
Top = 3000
Visible = 0 'False
Width = 1050
End
Begin VB.Image Image5
Height = 1050
Left = 2280
Picture = "地鼠娱乐部1.0.frx":B5F4
Top = 1920
Visible = 0 'False
Width = 1050
End
Begin VB.Image Image4
Height = 1050
Left = 2280
Picture = "地鼠娱乐部1.0.frx":F02E
Top = 840
Visible = 0 'False
Width = 1050
End
Begin VB.Image Image3
Height = 1500
Left = 135
Picture = "地鼠娱乐部1.0.frx":12A68
Top = 1260
Visible = 0 'False
Width = 1500
End
Begin VB.Image Image2
Height = 1500
Left = 810
Picture = "地鼠娱乐部1.0.frx":1A622
Top = 630
Visible = 0 'False
Width = 1500
End
Begin VB.Image Image1
Height = 1500
Left = 3480
MouseIcon = "地鼠娱乐部1.0.frx":221DC
MousePointer = 99 'Custom
Picture = "地鼠娱乐部1.0.frx":224E6
Top = 1305
Width = 1500
End
Begin VB.Menu 帮助
Caption = "地鼠帮助(&H)"
Begin VB.Menu 关于
Caption = "关于地鼠娱乐部(&A)"
End
Begin VB.Menu 使用
Caption = "使用(&R)"
End
End
Begin VB.Menu 发生
Caption = "游戏"
Begin VB.Menu nend
Caption = "退出"
Index = 1
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim 鼠X As Single, 鼠Y As Single, 地鼠 As Byte, 对数 As Integer, 总数 As Integer
Sub 判断(X, Y)
Select Case 地鼠
Case 0, 1, 2
X = 地鼠
Y = 0
Case 3, 4, 5
X = 地鼠 - 3
Y = 1
Case 6, 7, 8
X = 地鼠 - 6
Y = 2
End Select
End Sub
Private Sub Form_Load()
Randomize
Show
Print
For 地鼠 = 0 To 8
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
Next
总数 = 1
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move X - Image1.Width / 2, Y - Image1.Height / 2
鼠X = Image1.Left
鼠Y = Image1.Top
Timer1.Enabled = True
Label2.Caption = "运行中..."
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = Image3.Picture
xy = 99
If 鼠X > 800 And 鼠X < 1850 Then
If 鼠Y + 1500 > 1600 And 鼠Y + 1500 < 2350 Then xy = 0
If 鼠Y + 1500 > 2650 And 鼠Y + 1500 < 3400 Then xy = 3
If 鼠Y + 1500 > 3700 And 鼠Y + 1500 < 4450 Then xy = 6
End If
If 鼠X > 1850 And 鼠X < 2900 Then
If 鼠Y + 1500 > 1600 And 鼠Y + 1500 < 2350 Then xy = 1
If 鼠Y + 1500 > 2650 And 鼠Y + 1500 < 3400 Then xy = 4
If 鼠Y + 1500 > 3700 And 鼠Y + 1500 < 4450 Then xy = 7
End If
If 鼠X > 2900 And 鼠X < 3950 Then
If 鼠Y + 1500 > 1600 And 鼠Y + 1500 < 2350 Then xy = 2
If 鼠Y + 1500 > 2650 And 鼠Y + 1500 < 3400 Then xy = 5
If 鼠Y + 1500 > 3700 And 鼠Y + 1500 < 4450 Then xy = 8
End If
If 地鼠 = xy Then
对数 = 对数 + 1
Label1.Caption = "打中次数 :" & 对数
判断 X, Y
Form1.PaintPicture Image6.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
End If
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move 鼠X - (Image1.Width / 2 - X), 鼠Y - (Image1.Height / 2 - Y)
鼠X = Image1.Left
鼠Y = Image1.Top
End Sub
Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = Image2.Picture
End Sub

Private Sub nend_Click(Index As Integer)
End
End Sub

Private Sub Timer1_Timer()
总数 = 总数 + 1
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
地鼠 = Int(Rnd * 9)
判断 X, Y
Form1.PaintPicture Image4.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
If 总数 > 100 Then
Timer1.Enabled = False
判断 X, Y
Form1.PaintPicture Image5.Picture, 1000 + 1050 * X, 1000 + 1050 * Y
If 对数 > 100 Then
msg = MsgBox("恭喜" + Chr(13) + "你以经爆机了,还要继续吗?", vbYesNo, "地鼠娱乐部")
Else
msg = MsgBox("你以经过关了,您打中了" & 对数 & "次。还要继续吗?", vbYesNo, "地鼠娱乐部")
End If
If msg = vbYes Then
总数 = 1
对数 = 0
Timer1.Enabled = True
Else
Unload Me
End If
End If
End Sub
Private Sub 关于_Click()
MsgBox " 地鼠娱乐部" + Chr(13) + Chr(13) + "这是一个基于Windows98以上操作系统下" + Chr(13) + _
"用VB编写的程序", , "地鼠娱乐部"
End Sub
Private Sub 使用_Click()
MsgBox "欢迎来到地鼠娱乐部" + Chr(13) + "使用说明:" + Chr(13) + "鼠标左右键都可打击" _
+ "想要能更快的打到地鼠连续打击左右键," + Chr(13) + "那能加快打地鼠的次数", , "地鼠娱乐部"
End Sub
代码转载自:https://pan.quark.cn/s/8ce4326d996e 对于在 CentOS 7 系统中修改网卡配置文件后无法使设置生效的情况,经过实践验证,可以通过使用 nmcli 命令来进行调整。完成修改之后,需要重新启动虚拟机以使更改生效,这样操作流程即告完成。如果设置仍然无法生效,则表明虚拟机在启动过程中所获取的 IP 地址配置并非针对 eth0,此时可以对其它网卡的配置文件进行修改或将其移除。在 CentOS 7 系统中,网络配置的管理机制与早期版本存在差异,主要体现为采用了 Network Manager 服务来负责网络接口的管理。在某些情形下,尽管修改了 `/etc/sysconfig/network-scripts` 目录下的 `ifcfg-eth0` 文件,但网络配置却未能即时生效。此类问题的发生通常源于 CentOS 7 采用了不同于以往的配置读取方法。接下来将具体阐述如何借助 nmcli 命令来处理这一挑战。 以 root 用户身份登录系统并打开终端界面。nmcli 是 Network Manager 提供的命令行界面工具,它支持在命令行环境下执行网络连接的建立、编辑、查询及管理任务。针对修改 eth0 网卡配置的需求,可以遵循以下步骤进行操作: 1. 导航至 `/etc/sysconfig/network-scripts` 目录: ``` cd /etc/sysconfig/network-scripts ``` 2. 检查该目录内是否存在 `ifcfg-eth0.bak` 文件,该备份文件可能是先前调整配置时遗留下来的,若存在可能造成冲突。若发现该文件,可以选择将其删除: ``` [root@localhost netw...
代码转载自:https://pan.quark.cn/s/46fd08fb879c 网管教程 从入门到精通软件篇 ★一。★详尽的xp修复控制台指令及其应用!!! 放入xp(2000)的光盘,安装时选择R,执行修复! Windows XP(涵盖 Windows 2000)的控制台指令是在系统遭遇某些意外状况时的一种极具效用的诊断、检测以及恢复系统功能的工具。笔者确实一直期望能够将这方面的指令进行归纳,此次由老范辛苦整理了这份极具价值的秘籍。 Bootcfg bootcfg 命令用于启动配置与故障恢复(对大多数计算机而言,即 boot.ini 文件)。 带有特定参数的 bootcfg 命令仅在运用故障恢复控制台时方可使用。能够在命令行界面下运用带有不同参数的 bootcfg 命令。 用法: bootcfg /default 设定默认引导选项。 bootcfg /add 向引导清单中增添 Windows 安装。 bootcfg /rebuild 重复整个 Windows 安装流程并让用户选择需添加的项目。 注意:运用 bootcfg /rebuild 之前,应先借助 bootcfg /copy 命令备份 boot.ini 文件。 bootcfg /scan 探查用于 Windows 安装的全部磁盘并展示结果。 注意:这些结果被静态存储,并用于当前会话。若在当前会话期间磁盘配置发生变动,为获取更新的探查结果,必须先重启计算机,然后再次探查磁盘。 bootcfg /list 列示引导清单中已有的项目。 bootcfg /disableredirect 在启动引导程序中禁用重定向。 bootcfg /redirect [ PortBaudRrate] |[ useBio...

7,788

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧