安卓打地鼠游戲源碼
『壹』 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;
}
『貳』 求下用FLASH做一個簡單的打地鼠的游戲的具體步驟
1.
准備美術素材,
鼠洞,鼠進洞動畫,出洞動畫,
打鼠的錘子
2.
把 鼠洞,鼠進洞動畫,出洞動畫
,這些組合到一個MovieClip,然後復制幾個(假如是10個)放到舞台上,取好名mc0~mc9
3.
寫程序,
(1)用打鼠的錘子
代替滑鼠
(2)
控制地vnu
: 設個定時器,一定時間內用隨機數取,取0-9的中任意數,播放出洞動畫,
出洞的mc偵聽滑鼠點擊,被點後計分,
沒被點,定時播放進洞動畫,收進洞里,不能點擊.
4.
這是最簡單的,要其它規則自己加,比如,設定有不同的地鼠,打到多少後游戲結束,或者定時結束,統計打了多少個
『叄』 誰知道安卓游戲源碼下載的網站
可以去易查、手游、手機樂園、等網站。進行相對應的機型綁定…就可以下載自己喜歡的游戲! 91里就應該有吧 這位朋友您好你在泡椒網安卓論壇上下載
『肆』 誰有打地鼠的源代碼
哈哈
bjtu的吧~
我們班的那個也還沒頭緒呢~
『伍』 求SDL2打地鼠游戲的源代碼 急求,求好心人
恰巧我找到一個,沒法發鏈接,你在圖片上的網站搜「打地鼠游戲機,自己動手(附電路圖,源代碼,元件清單,視頻)」應該就可以搜到了,內容很詳細,希望可以幫到你~~
『陸』 按鍵精靈安卓類是打地鼠代碼問題 高手進
首先,找圖區域錯誤.其次,按照腳本邏輯是不算的重復顯示0123,不管找沒有找到圖,因為顯示沒有在條件判斷裡面.如果要求沒有找到圖則顯示0123,那麼ShowMessage要寫到判斷里的否則語句下面
『柒』 flash 仿「金山打字通之打地鼠」(打字游戲) 源碼
個簡單的Flash打字游戲
上一篇 / 下一篇 2007-09-25 16:42:03
查看( 142 ) / 評論( 3 ) / 評分( 5 / 0 )
代碼:
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
打字游戲 ——V1.0
日期:2007-9-24
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
定義變數
----------------------------------------------------------------------------------------------
*/
fscommand("fullscreen", true);
var Bring_num:Number = 0;
var Bring_maxnum:Number = 20;
var Grade_num:Number = 1;
var Grade_bring:Number = 100;
var Move_speed:Number = 2;
var Bring_speed:Number = 0;
var Press_num:Number = 0;
var Right_num:Number = 0;
var Loss_num:Number = 0;
var Grade_boolean:Boolean = false;
var Interval_num:Number = 0;
var Listener:Object = new Object();
var Addsound:Sound = new Sound();
var Addblast_mc:Object = new Object();
var Time_m:Number = 0;
var Time_s:Number = 1;
var Hide_id:Number;
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bring_word函數功能:隨機產生字元
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
function Bring_word() {
var color_array:Array = new Array(0xffffff, 0x9B4A8B, 0xE0C0DB, 0xAC285E, 0x235CB1, 0x379D37, 0xB1A323);
var txtstyle:TextFormat = new TextFormat();
txtstyle.bold = true;
txtstyle.font = "宋體";
txtstyle.size = 20;
txtstyle.color = color_array[random(7)];
_root.Bring_num++;
if (_root.Bring_num>=Bring_maxnum) {
_root.Bring_num = 0;
}
switch (random(2)) {
case 0 :
txt = random(26)+97;
break;
case 1 :
txt = random(10)+48;
break;
}
_root.createTextField("txt"+_root.Bring_num, _root.Bring_num, random(Stage.width), -(random(200)+10), 25, 25);
this["txt"+_root.Bring_num].text = chr(txt);
this["txt"+_root.Bring_num].setTextFormat(txtstyle);
}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Interval_event();初始化時產生的字元個數
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
function Interval_event() {
Bring_word();
Interval_num++;
if (Interval_num>=3) {
clearInterval(Interval_id);
}
}
var Interval_id:Number = setInterval(Interval_event, 1000);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cyc_event下落函數
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
function cyc_event() {
function _event() {
for (var i = 0; i<=Bring_maxnum; i++) {
var n:Number = random(2) ? -Math.random()*9 : Math.random()*9;
_root["txt"+i]._y += Move_speed;
_root["txt"+i]._x += n;
if (_root["txt"+i]._y>Stage.height) {
_root["txt"+i].removeTextField();
Bring_word();
Loss_num++;
loss_txt.text = Loss_num;
}
}
}
var cyc_id:Number = setInterval(_event, 50);
}
cyc_event();
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
監聽鍵盤
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
Key.addListener(Listener);
Listener.onKeyDown = function() {
Press_num++;
//trace(Press_num);
if (Grade_boolean) {
Grade_num++;
Grade_boolean = false;
grade_txt.text = "第"+Grade_num+"關";
Move_speed += 2;
for (var i = 0; i<3; i++) {
Bring_word();
}
}
//trace("Press_num="+Press_num);
for (i=0; i<=Bring_maxnum; i++) {
if (_root["txt"+i].text == chr(Key.getAscii())) {
Right_num++;
Addsound.attachSound("Sound_mc");
Addsound.start();
//_root.attachMovie("Blast_mc", "Addblast_mc", _root.getNextHighestDepth(), {_x:_root["txt"+i]._x, _y:_root["txt"+i]._y});
Blast_mc.play();
Blast_mc._x = _root["txt"+i]._x;
Blast_mc._y = _root["txt"+i]._y;
_root["txt"+i].removeTextField();
Bring_word();
if (Right_num>=Grade_bring and Right_num%Grade_bring == 0) {
Grade_boolean = true;
} else {
Grade_boolean = false;
}
}
}
right_txt.text = String(Right_num);
if (Press_num-Right_num>0) {
wrong_txt.text = String(Press_num-Right_num);
} else {
Press_num += Math.abs(Press_num-Right_num);
}
};
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
時間函數
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
*/
function Time_event() {
Time_s++;
if (Time_s/60>1) {
Time_m++;
Time_s = 1;
}
time_txt.text = Time_m+":"+Time_s%60;
}
setInterval(Time_event, 1000);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
簡介函數
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
var newmenu:ContextMenu = new ContextMenu();
newmenu.hideBuiltInItems();
this.menu = newmenu;
newmenu.customItems.push(new ContextMenuItem("作者:Edward.yang", by_event));
newmenu.customItems.push(new ContextMenuItem("QQ:77839683", getqq));
newmenu.customItems.push(new ContextMenuItem("退出", exit_event, true));
function exit_event() {
fscommand("quit", "");
}
function by_event() {
Hide_id = setInterval(hide_by, 5000);
by_mc.gotoAndStop(2);
by_mc._alpha = 0;
by_mc.onEnterFrame = function() {
this._alpha += (100-this._alpha)/8;
this._x += (Stage.width/2-this._x)/8;
this._y += (Stage.height/2-this._y)/8;
//trace(this._alpha);
if (this._alpha>=100) {
delete by_mc.onEnterFrame;
}
};
}
function hide_by() {
by_mc.onEnterFrame = function() {
this._alpha -= 8;
//trace(this._alpha);
if (this._alpha<=0) {
this.gotoAndStop(1);
clearInterval(Hide_id);
delete by_mc.onEnterFrame;
}
};
}
function getqq() {
getURL("tencent://message/?uin=77839683");
『捌』 大神快來,我做到打地鼠游戲,為什麼老鼠不會消失
我知道,但是你上一個回答還沒處理呢。
我不想告訴你。
『玖』 求一個mit appinventor平台下打地鼠的源代碼