#include
#include
#include
#pragma comment (lib,"winmm.lib")
IMAGE img;
char buffer[10];
void ShowPicture();
void playgame();
int a[8][8]=
{0,0,6,1,6,0,0,0,
0,0,6,3,6,0,0,0,
0,0,6,2,1,1,1,6,
6,1,1,4,2,4,3,6,
6,3,2,4,5,6,1,1,
1,1,1,6,4,6,0,0,
0,0,0,6,3,6,0,0,
0,0,0,1,1,1,0,0,
};
int b[8][8]={0,0,0,6,6,0,0,0,
0,6,1,1,1,6,6,0,
6,6,3,4,2,6,6,0,
6,1,1,1,2,6,6,0,
6,3,4,5,2,2,6,0,
6,6,2,2,2,4,6,6,
1,1,6,6,1,3,1,1,
0,0,1,1,0,1,0,0,
};
void main()
{ initgraph(600,600);
mciSendString("play fight.wav",0,0,0);
getimage(&img,"start.jpg");
putimage(0,0,&img);
getch();
getimage(&img,"how.jpg");
putimage(0,0,&img);
getch();
ShowPicture();
playgame();
mciSendString("play ko.wav",0,0,0);
//round 2****************************************
for (int i=0;i<8;i++)
{
for (int j=0;j<8;j++)
{
a[i][j]=b[i][j];
}
}
initgraph(600,600);
getimage(&img,"baozou.jpg");
putimage(0,0,&img);
getch();
ShowPicture();
playgame();
mciSendString("play ko.wav",0,0,0);
getimage(&img,"win.jpg");
putimage(0,0,&img);
getch();
}
void ShowPicture()
{
getimage(&img,"wallpage.jpg");
putimage(0,0,&img);
for (int i=0;i<8;i++)
{
for(int j=0;j<8;j++)
{
if (a[i][j]==1)//正墙
{
sprintf(buffer,"1.jpg",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==6)//侧墙
{
sprintf(buffer,"6.jpg",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==5)//人
{
sprintf(buffer,"1.1.bmp",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==3)//点
{
sprintf(buffer,"1.2.bmp",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==4)//箱子
{
sprintf(buffer,"xiangzi.jpg",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==7)//点&箱子
{
sprintf(buffer,"1.3.bmp",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
if (a[i][j]==8)//人&点
{
sprintf(buffer,"1.4.jpg",a[i][j]);
getimage(&img,buffer);
putimage(j*75,i*75,&img);
}
}
}
}