首页 > > 详细

辅导留学生C/C++设计、C/C++编程解析、辅导C/C++、C/C++程序讲解留学生

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ROW 20
#define COL 50
int arr[1111][1111]={0};
int boardx,boardy;
int ballx,bally;
int speed=1000;
int intTreasure=0; //
int getTreasure=0; //
bool iscatch = 0;
bool starting = 0;
int velocity_x = 1;
int velocity_y = -1;
int number;//
int CreatBrick();//
void initGame();//
void BoardMove();//
void BallMove(int *X,int *Y,int len);//
void move_Treasure();
void get_Treasure();
void time_Treasure();
clock_t treaTime_Last,treaTime_Now; //
struct TREASURE //
{
int x;
int y;
int type;
}Treasure;
void maininterface()//
{
void color(int a);
void gotoxy(int x, int y);
static const char *game[] = { "☆New Game","☆Create Maps","☆Game Help","☆Exit Game" };
color(1);
gotoxy(35, 5);
printf(" ---------------");
gotoxy(35, 6);
printf("┃%2s%s%2s┃", "", "★Krakout★", "");
gotoxy(35, 7);
printf(" ---------------");
color(2);
gotoxy(35, 10);
printf("%2s%s%2s","", game[0], "");
color(3);
gotoxy(35, 14);
printf("%2s%s%2s", "", game[1], "");
color(4);
gotoxy(35, 18);
printf("%2s%s%2s", "", game[2], "");
color(5);
gotoxy(35, 22);
printf("%2s%s%2s", "", game[3], "");
getchar();
}
void gotoxy(int x, int y)//
{
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void color(int a)//
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), a);
}
int main()//
{
maininterface();
scanf("%d",number);//
initgraph(440,600);//,440,600.
initGame();
while(3)
{
CreatBrick();
if (_kbhit())
{
BoardMove();
}
if(intTreasure==1)
{
move_Treasure();
}
if(getTreasure==1) //
{
treaTime_Now=clock();
if(treaTime_Now-treaTime_Last 590)
break ;
}
getch();
return 0;
}
void initGame()//
{
boardx=250;//
boardy=590;
ballx=290;//
bally=580;
setfillcolor(BLUE);
solidrectangle(boardx,boardy,boardx+80,boardy+10);//80,10;
setfillcolor(WHITE);
solidcircle(ballx,bally,10);//10
}
int CreatBrick()//
{
switch(number)//
{
case 1://
{
}break;
case 2://1
{
int X2[115],Y2[115];
for(int i=0;i= 520)
boardx = 520;
setfillcolor(BLUE);
solidrectangle(boardx, boardy, boardx + 80, boardy + 10);
}
void BallMove(int *X,int *Y,int len)//
{
iscatch = 0;
setfillcolor(BLACK);
solidcircle(ballx, bally, 10);
BeginBatchDraw();
if (ballx >= 430 || ballx = x - 10 ballx = y - 10)
{
if (bally >= y bally = x ballx boardy)
y--;
Treasure.y=K;
}
}
}
if (startingballx > boardx - 10 ballx = boardy - 10 bally =boardxballx280)
boardx = 280;
setfillcolor(BLUE);
solidrectangle(boardx,boardy,boardx+160,boardy+10);//80,10;
break;
case 4: //
setfillcolor(BLUE);
solidrectangle(boardx,boardy,boardx+40,boardy+10);//80,10;
break;
}
getTreasure=1; //
treaTime_Last =clock(); //
}
//
void time_Treasure()
{
switch(Treasure.type)
{
case 1: //
speed=1000;
break;
case 2: //
speed=1000;
break;
case 3: //
setfillcolor(BLUE);
solidrectangle(boardx,boardy,boardx+80,boardy+10);//80,10;
break;
case 4: //
if(boardx360)
boardx = 360;
setfillcolor(BLUE);
solidrectangle(boardx,boardy,boardx+80,boardy+10);//80,10;
break;
}
}
 

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!