十全十美游戏
2008-03-08 12:47:52 来源:WEB开发网核心提示://十全十美游戏//6*6一直到10*10,不过我只玩过6*6,其它的不知道能不能过//按p键可以跳关#define Up 0x4800#define Down 0x5000#define P 0x1970#define R 0x1372#define Enter 0x1c0d#define Esc 0x11
//十全十美游戏
//6*6一直到10*10,不过我只玩过6*6,其它的不知道能不能过
//按p键可以跳关 #define Up 0x4800
#define Down 0x5000
#define P 0x1970
#define R 0x1372
#define Enter 0x1c0d
#define Esc 0x11b
#define Right 0x4d00
#define Left 0x4b00 #include<bios.h>
#include<stdio.h>
#include<dos.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h> //定义核心数据
int LargeStartx;
int LargeStarty; //大方格的起始位置
int SmallStartx;
int SmallStarty; //小方格的起始位置 int array=5; //行列式的大小
int position; //方格的位置用0-array*array-1表示 typedef strUCt rect2 //定义大方格的属性即移动方格的属性
{
int nowx;
int nowy;
int agox;
int agoy;
int size;//40
char color;
}Large;
Large LargeRect;
char Attr[10*10]; //记录小方格的状态,用'W'(white)与'R'(red)表示。 typedef struct add //用于改变小方格颜色时,五个方向的增加量(包括当前位置)
{
int x;
int y;
int p;
}Add; typedef struct rect1 //记录小方格的当前位置=大方格的当前位置-(大方格的大小-小方格的大小)/2,x轴与y轴一样
{
int nowx;
int nowy;
int size; //20
char color;
}Small;
Small SmallRect; void ChargeColor(int );
void InitData1();
void InitData2();
void DrawLargeRect(int ,int ,int ,char );
void DrawSmallRect(int ,int ,int ,char );
void InitPic();
int Win();
int Judge(int ,int );
void main()
{
int key;
int gdriver=DETECT, gmode;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
InitData1();
InitData2();
InitPic();
do
{
key=bioskey(0);
LargeRect.agox=LargeRect.nowx;
LargeRect.agoy=LargeRect.nowy;
switch(key)
{
case Up:
{
LargeRect.nowy-=LargeRect.size;
if(LargeRect.nowy<LargeStarty) {LargeRect.nowy+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=array;
break;
}
case Down:
{
LargeRect.nowy+=LargeRect.size;
if(LargeRect.nowy>LargeStarty+LargeRect.size*(array-1)) {LargeRect.nowy-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=array;
break;
}
case Left:
{
LargeRect.nowx-=LargeRect.size;
if(LargeRect.nowx<LargeStartx) {LargeRect.nowx+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=1;
break;
}
case Right:
{
LargeRect.nowx+=LargeRect.size;
if(LargeRect.nowx>LargeStartx+LargeRect.size*(array-1)) {LargeRect.nowx-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=1;
break;
}
case P:
{
setbkcolor(BLUE);
cleardevice();
if(array<10) array++;
else array=5;
InitData2();
InitPic();
break;
}
case R:
{
setbkcolor(BLUE);
cleardevice();
InitData2();
InitPic();
break;
}
case Enter:
{
SmallRect.nowx=LargeRect.nowx+10;
SmallRect.nowy=LargeRect.nowy+10;
for(int i=0;i<5;i++)
ChargeColor(i);
break;
}
case Esc:
{
closegraph();
exit(1);
}
}
if(Win())
{
outtextxy(100,50,"CONGRATULATIONS!");
sleep(5);
setbkcolor(BLUE);
cleardevice();
if(array<10) array++;
else array=5;
//6*6一直到10*10,不过我只玩过6*6,其它的不知道能不能过
//按p键可以跳关 #define Up 0x4800
#define Down 0x5000
#define P 0x1970
#define R 0x1372
#define Enter 0x1c0d
#define Esc 0x11b
#define Right 0x4d00
#define Left 0x4b00 #include<bios.h>
#include<stdio.h>
#include<dos.h>
#include<graphics.h>
#include<conio.h>
#include<stdlib.h> //定义核心数据
int LargeStartx;
int LargeStarty; //大方格的起始位置
int SmallStartx;
int SmallStarty; //小方格的起始位置 int array=5; //行列式的大小
int position; //方格的位置用0-array*array-1表示 typedef strUCt rect2 //定义大方格的属性即移动方格的属性
{
int nowx;
int nowy;
int agox;
int agoy;
int size;//40
char color;
}Large;
Large LargeRect;
char Attr[10*10]; //记录小方格的状态,用'W'(white)与'R'(red)表示。 typedef struct add //用于改变小方格颜色时,五个方向的增加量(包括当前位置)
{
int x;
int y;
int p;
}Add; typedef struct rect1 //记录小方格的当前位置=大方格的当前位置-(大方格的大小-小方格的大小)/2,x轴与y轴一样
{
int nowx;
int nowy;
int size; //20
char color;
}Small;
Small SmallRect; void ChargeColor(int );
void InitData1();
void InitData2();
void DrawLargeRect(int ,int ,int ,char );
void DrawSmallRect(int ,int ,int ,char );
void InitPic();
int Win();
int Judge(int ,int );
void main()
{
int key;
int gdriver=DETECT, gmode;
registerbgidriver(EGAVGA_driver);
initgraph(&gdriver, &gmode, "");
setbkcolor(BLUE);
cleardevice();
InitData1();
InitData2();
InitPic();
do
{
key=bioskey(0);
LargeRect.agox=LargeRect.nowx;
LargeRect.agoy=LargeRect.nowy;
switch(key)
{
case Up:
{
LargeRect.nowy-=LargeRect.size;
if(LargeRect.nowy<LargeStarty) {LargeRect.nowy+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=array;
break;
}
case Down:
{
LargeRect.nowy+=LargeRect.size;
if(LargeRect.nowy>LargeStarty+LargeRect.size*(array-1)) {LargeRect.nowy-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=array;
break;
}
case Left:
{
LargeRect.nowx-=LargeRect.size;
if(LargeRect.nowx<LargeStartx) {LargeRect.nowx+=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position-=1;
break;
}
case Right:
{
LargeRect.nowx+=LargeRect.size;
if(LargeRect.nowx>LargeStartx+LargeRect.size*(array-1)) {LargeRect.nowx-=LargeRect.size;continue;}
setwritemode(1);
DrawLargeRect(LargeRect.agox,LargeRect.agoy,LargeRect.size,LargeRect.color);
DrawLargeRect(LargeRect.nowx,LargeRect.nowy,LargeRect.size,LargeRect.color);
setwritemode(0);
position+=1;
break;
}
case P:
{
setbkcolor(BLUE);
cleardevice();
if(array<10) array++;
else array=5;
InitData2();
InitPic();
break;
}
case R:
{
setbkcolor(BLUE);
cleardevice();
InitData2();
InitPic();
break;
}
case Enter:
{
SmallRect.nowx=LargeRect.nowx+10;
SmallRect.nowy=LargeRect.nowy+10;
for(int i=0;i<5;i++)
ChargeColor(i);
break;
}
case Esc:
{
closegraph();
exit(1);
}
}
if(Win())
{
outtextxy(100,50,"CONGRATULATIONS!");
sleep(5);
setbkcolor(BLUE);
cleardevice();
if(array<10) array++;
else array=5;
- ››游戏定位成牵引Android发展的火车头
- ››游戏场景烘焙贴图制作
- ››游戏植物大战僵尸 iPhone 版9天销售额超100万美元...
- ››游戏开发包 iPhone cocos2d 初体验
- ››游戏三维怪物施法特效教程
- ››游戏人生Silverlight(2) - 趣味钢琴[Silverlight ...
- ››游戏人生Silverlight(3) - 打苍蝇[Silverlight 2....
- ››游戏人生Silverlight(4) - 连连看[Silverlight 2....
- ››游戏人生Silverlight(5) - 星际竞技场[Silverligh...
- ››游戏《封神榜》人物纣王3DMAX制作全过程
- ››游戏加速器中的领头羊-网际速递
- ››游戏引擎Valve Source奔向Linux
赞助商链接