Ⅰ 求下用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單片機設計一個打地鼠的游戲機,有誰可以給我編一個程序的如果可以用的話我會追加分數
樓主,容我冒昧的說一句,你的要求相對適中,但是相比其他提問技術含量較高,會佔用設計者一定的業余時間,而且初始分數確實不怎麼漂亮,實在是吸引不到高手為你解答,估計你也是考慮到很可能沒人解決才不放分的吧?呵呵