安卓打地鼠游戏源码
‘壹’ 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平台下打地鼠的源代码