导航:首页 > 操作系统 > 单片机打地鼠游戏

单片机打地鼠游戏

发布时间:2023-07-29 04:50:40

Ⅰ 求下用FLASH做一个简单的打地鼠的游戏的具体步骤

1.
准备美术素材,
鼠洞,鼠进洞动画,出洞动画,
打鼠的锤子
2.
把 鼠洞,鼠进洞动画,出洞动画
,这些组合到一个MovieClip,然后复制几个(假如是10个)放到舞台上,取好名mc0~mc9
3.
写程序,
(1)用打鼠的锤子
代替鼠标

(2)
控制地vnu
: 设个定时器,一定时间内用随机数取,取0-9的中任意数,播放出洞动画,
出洞的mc侦听鼠标点击,被点后计分,
没被点,定时播放进洞动画,收进洞里,不能点击.
4.
这是最简单的,要其它规则自己加,比如,设定有不同的地鼠,打到多少后游戏结束,或者定时结束,统计打了多少个

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

Ⅲ C语言编程打地鼠

刚写好的,打地鼠小游戏。

功能:每三秒,会在游戏区域随机位置刷出地鼠,鼠标点击地鼠,无论点中与否,地鼠都会立即刷新。

点中地鼠按你要求计分,点不中记录失败次数,3次失败,游戏结束,显示GAME OVER!

#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<string.h>
#include<malloc.h>
#definegSizek30//区域大小宽度
#definegSizeg20//区域大小高度
#definegBegin3//活动区域起始行
intmain()
{
intt=0,s0,s1,i,j,count=0,fen=0,row=0,clo=0;
chargameA[gSizeg][gSizek+1],fSave[10]={0};
SetConsoleTitle("打地鼠");
HANDLEhInput=GetStdHandle(STD_INPUT_HANDLE);//获取标准输入设备句柄
INPUT_RECORDinRec;
DWORDres;
COORDp0;
p0.X=0;
p0.Y=0;

srand(time(0));
s0=time(NULL);
strcpy(gameA[0],"GAME");
strcpy(gameA[1],"未命中次数:0,计分:000000");
for(i=gBegin-1;i<gSizeg;i++)
{
for(j=0;j<gSizek+1;j++)
{
if(i>gBegin-1&&i<gSizeg-1&&j>0&&j<gSizek-1)
gameA[i][j]='';
else
gameA[i][j]=4;
if(j==gSizek)
gameA[i][j]=0;
}
}
for(i=0;i<gSizeg;i++)
printf("%s ",gameA[i]);

while(1)
{

if(t>=3)
{
if(row>0&&clo>0)
gameA[row][clo]='';
row=rand()%(gSizeg-1);
clo=rand()%(gSizek-1);
s0=time(NULL);
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),p0);

if(row<3)
row=4;
if(clo<1)
clo=1;
gameA[row][clo]=2;
for(i=0;i<gSizeg;i++)
{
//gameA[i][gSizeg+1]=0;
printf("%s ",gameA[i]);
}

}
if(count==3)
{
p0.X=10;
p0.Y=8;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),p0);
printf("GAMEOVER!");
break;
}
s1=time(NULL);
t=s1-s0;
ReadConsoleInput(hInput,&inRec,1,&res);
if(inRec.EventType==MOUSE_EVENT&&inRec.Event.MouseEvent.dwButtonState==FROM_LEFT_1ST_BUTTON_PRESSED)//鼠标左键
{
if(inRec.Event.MouseEvent.dwMousePosition.X==clo&&inRec.Event.MouseEvent.dwMousePosition.Y==row)
{

if(fen==0)
fen=1;
if(fen>999999)
fen=999999;
else
fen=fen*2;

sprintf(fSave,"%06d",fen);
gameA[1][18]=0;
strcat(gameA[1],fSave);
}
else
{
count++;
fen=0;
gameA[1][11]=count+'0';
}
t=4;
}
}
while(1);
return0;
}

Ⅳ 基于单片机的打地鼠游戏,论文答辩时大概会问什么

用什么后台制作

Ⅳ 我想用89c52单片机设计一个打地鼠的游戏机,有谁可以给我编一个程序的如果可以用的话我会追加分数

楼主,容我冒昧的说一句,你的要求相对适中,但是相比其他提问技术含量较高,会占用设计者一定的业余时间,而且初始分数确实不怎么漂亮,实在是吸引不到高手为你解答,估计你也是考虑到很可能没人解决才不放分的吧?呵呵

阅读全文

与单片机打地鼠游戏相关的资料

热点内容
stc仿真器编程器 浏览:155
服务器销售怎么做好 浏览:87
什么是com编程 浏览:848
算法工程师最新资讯 浏览:608
邮政银行卡怎么在app签约绑定 浏览:49
压缩卷一直转 浏览:976
初一编程小程序怎么做 浏览:826
bt软件文件夹名称 浏览:157
unix创建命令 浏览:622
devc是多少位的编译器 浏览:980
怎么样能快点升安卓系统 浏览:976
奇迹mu用什么服务器 浏览:605
如何让软件在多个安卓系统上运行 浏览:574
java判断半角 浏览:880
java判断正负 浏览:320
刷头条程序员的日常 浏览:103
吉林程序员吐槽 浏览:243
单片机温度范围 浏览:420
程序员为什么素质低 浏览:897
可爱的程序员小姐姐 浏览:147