导航:首页 > 源码编译 > h5打地鼠游戏源码

h5打地鼠游戏源码

发布时间:2024-03-21 10:02:44

❶ c语言中怎么写打地鼠的游戏

在一个二维数组中,存放标记。

设置难度:分:

对应产生2*N个随机数,对应(x,y),设置为1,其它空的设置为0.



大概的游戏流程循环:

结束条件: 打到M个停止。

1,产生随机数,且不相同

2,在对应的坐标中,画出地鼠,

在N秒内,没有击中,地鼠消失;击中,加分。

(击中的坐标,要与用户点的坐标想比较即可,在这个范围就得分)


❷ 如何用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

阅读全文

与h5打地鼠游戏源码相关的资料

热点内容
excel表格单列数据加密 浏览:646
给同事的解压话语 浏览:990
linux关闭网卡命令行 浏览:452
史上最漂亮程序员 浏览:768
java实现excel的导入 浏览:758
光遇账号如何转移安卓 浏览:266
5分之13除以26的算法 浏览:342
兰州安宁区买解压包子 浏览:641
php接收图片代码 浏览:668
hci命令 浏览:662
福建服务器大区云空间 浏览:840
笔杆子程序员 浏览:745
手机软件易验证加密 浏览:589
文档加密只读模式也不能看到 浏览:431
把jpg转换成pdf的软件 浏览:874
linuxeth0mac 浏览:192
windows编程知乎 浏览:442
压缩工期超过40 浏览:249
Android怎么优化内存 浏览:106
linuxetcsysconfig 浏览:396