wxc.cpp
来自「Turbo C++2.0下的迷宫程序,这是我的课程设计,里面有自己用乐谱演奏的音」· C++ 代码 · 共 723 行 · 第 1/2 页
CPP
723 行
cprintf("You can press the kye : H : for help.");
}
void Tmigong::play1()
{
gotoxy(beginx+manj,beginy+mani);
addcode("o3hcc5c4f5d4fga5a4<b5g4ab>c4dec<baga5");
while(1)
{
if(kbhit())
{
int ch1=getch();
if((ch1==27)||(ch1=='q'))break;
//if(ch1==104) {automove(); break; }
if(ch1==0)
{
int ch2=getch();
switch(ch2)
{
case 75:if((mapshu1[mani][manj-1]!=1)&&(manj-1>-1))moveleft(); break;
case 77:if((mapshu1[mani][manj+1]!=1)&&(manj+1<mapj))moveright(); break;
case 72:if((mapshu1[mani-1][manj]!=1)&&(mani-1>-1))moveup(); break;
case 80:if((mapshu1[mani+1][manj]!=1)&&(mani+1<mapi))movedown();break;
}
if(mapshu1[mani][manj]==4)
{
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"u:\\BORLANDC\\bgi");
cleardevice();
setbkcolor(12);
settextstyle(1,0,2);
outtextxy(170,200,"you have finished the task");
outtextxy(170,250,"The tine you spend in the game is:");
outtextxy(170,300,"If you want to go out press Q");
getch();
closegraph();
break;
}
}
}
// musicplay();
}
}
void Tmigong::play2()
{
gotoxy(beginx+manj,beginy+mani);
addcode("o3hcc5c4f5d4fga5a4<b5g4ab>c4dec<baga5");
while(1)
{
if(kbhit())
{
int ch1=getch();
if((ch1==27)||(ch1=='q'))break;
if(ch1=='h') {automove(); break;}
if(ch1==0)
{
int ch2=getch();
switch(ch2)
{
case 75:if((mapshu2[mani][manj-1]!=1)&&(manj-1>-1))moveleft(); break;
case 77:if((mapshu2[mani][manj+1]!=1)&&(manj+1<mapj))moveright(); break;
case 72:if((mapshu2[mani-1][manj]!=1)&&(mani-1>-1))moveup(); break;
case 80:if((mapshu2[mani+1][manj]!=1)&&(mani+1<mapi))movedown();break;
}
if(mapshu2[mani][manj]==4)
{
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"u:\\BORLANDC\\bgi");
cleardevice();
setbkcolor(12);
settextstyle(1,0,2);
outtextxy(170,200,"you have finished the task");
outtextxy(170,250,"The tine you spend in the game is:");
outtextxy(170,300,"If you want to go out press Q");
getch();
closegraph();
break;
}
}
}
// musicplay();
}
}
void showwindow2()
{
int x=18;
clrscr();
for(int i=1;i<6;i++)
{
gotoxy(x,5+i);
textcolor(i+128);
cprintf("@ # $ % & * * & % $ # @ @ # $ % & * * & % $ # @");
}
gotoxy(x,11);
textcolor(6);
cprintf("@ # $ % & If you want to go into & % $ # @");
gotoxy(x,12);
textcolor(7);
cprintf("@ # $ % & You can press the >> D & % $ # @");
for(int j=8;j<13;j++)
{
gotoxy(x,5+j);
textcolor(j+128);
cprintf("@ # $ % & * * & % $ # @ @ # $ % & * * & % $ # @");
}
getch();
}
void showwindow7()
{
cleardevice();
setbkcolor(12);
textattr(70<<2);
settextstyle(0,0,5) ;
setcolor(14);
for(int p=150;p<170;p++)
{
circle(300,170,p);
}
settextstyle(0,0,2) ;
outtextxy(200,170,"WAITING.....");
settextstyle(0,0,5) ;
outtextxy(100,400,"loading..............");
getch();
}
void showwindow1()
{
cleardevice();
// for(int t=16;t>3;t--)
// { setbkcolor(t); delay(200);continue; }
setbkcolor(1);
setcolor(14);
for(int j=100;j<110;j++)
{
circle(250,240,j);
}
for(int w=100;w<110;w++)
{
circle(300,240,w);
}
/* for(int c=100;c<110;c++)
{
circle(350,170,j);
}
for(int b=100;b<120;b++)
{
circle(400,170,j);
}*/
settextstyle(0,0,2);
outtextxy(100,90,"Welcome to playing my game!");
setlinestyle(1,0,3);
int y=-100;
for(int h=1;h<14;h++)
{
setcolor(4);delay(50);
line(75,290+y,100,315+y);
line(130,285+y,100,315+y);
line(100,285+y,100,355+y);
line(73,335+y,100,320+y);
line(132,338+y,102,321+y);
line(71,317+y,131,318+y);
line(53,310+y,69,365+y);
line(51,345+y,133,360+y);
}
for(int k=16;k>1;k--)
{
setcolor(7);delay(50);
line(197,276+y,210,284+y);
line(178,297+y,245,297+y);
line(167,313+y,175,297+y);
line(240,310+y,248,297+y);
line(185,317+y,225,317+y);
line(188,330+y,222,330+y);
line(185,317+y,188,330+y);
line(225,317+y,222,330+y);
line(174,345+y,233,345+y);
line(179,362+y,228,362+y);
line(174,345+y,179,362+y);
line(233,345+y,228,362+y);
}
for(int l=16;l>3;l--)
{
setcolor(10); delay(50);
line(305,275+y,340,277+y);
line(309,293+y,340,290+y);
line(302,309+y,340,304+y);
line(340,277+y,340,304+y);
line(280,333+y,355,328+y);
line(330,312+y,330,365+y);
line(333,368+y,313,348+y);
line(300,325+y,310,336+y);
}
for(int m=16;m>0;m--)
{
setcolor(13);delay(50);
line(420,276+y,433,284+y);
line(400,297+y,467,297+y);
line(389,313+y,397,297+y);
line(462,310+y,470,297+y);
line(408,317+y,446,317+y);
line(405,340+y,450,340+y);
line(400,362+y,455,362+y);
line(427,320+y,427,360+y);
line(445,360+y,433,348+y);
}
setcolor(14);
settextstyle(0,0,1);
outtextxy(120,380,"My QQ is 157997821 and Email is 2008wangxiaocong@163.com");
outtextxy(180,410,"Maked by wangxiaocong------2004-01-01");
getch();
/* cleardevice();
setbkcolor(9);
settextstyle(0,0,2);
outtextxy(60,180,"if you want go into the game ") ;
settextstyle(1,0,2);
outtextxy(120,240,"press F for first grade");
outtextxy(120,300,"input S for second grade");*/
// char ch1=getch();
// if(ch1==102)
// {
showwindow5();
showwindow7();
/* cleardevice();
setbkcolor(12);
textattr(70<<2);
settextstyle(0,0,5) ;
for(int p=150;p<170;p++)
{
circle(300,170,p);
}
settextstyle(0,0,2) ;
outtextxy(200,170,"WAITING.....");
settextstyle(0,0,5) ;
outtextxy(100,400,"loading..............");
// }
sleep(2);*/
}
void showwindow3()
{
int x=18;
clrscr();
for(int i=1;i<6;i++)
{
gotoxy(x,5+i);
textcolor(i+128);
cprintf("* * * * * * * * * * * * * * * * * * * * * * ");
}
cprintf(" ");
gotoxy(x,11);
textcolor(6);
cprintf("# # # # # # SEE YOU NEXT TIME # # # # # #");
for(int j=8;j<13;j++)
{
gotoxy(x,5+j);
textcolor(j+128);
cprintf("$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $");
}
getch();
clrscr();
textcolor(5);
}
void showwindow4()
{
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"u:\\BORLANDC\\bgi");
cleardevice();
setcolor(12);
settextstyle(1,0,5);
outtextxy(160,210,"You are great!!!!");
for(int j=1;j<50;j++)
{
delay(100);
setcolor(j);
ellipse(300,250,0,360,170+j,100+j);
}
for(int k=3;k<50;k++)
{
delay(100);
setcolor(k);
rectangle(30+k,50+k,520+k,400+k);
}
getch();
closegraph();
}
void main()
{
showwindow2();
Tmigong mg;
int gdriver=DETECT,gmode,errorcode;
initgraph(&gdriver,&gmode,"u:\\BORLANDC\\bgi");
showwindow1();
cleardevice();
setbkcolor(9);
settextstyle(0,0,2);
outtextxy(60,180,"if you want go into the game ") ;
settextstyle(1,0,2);
outtextxy(120,240,"press F for first grade");
for(int k=3;k<13;k++)
{
delay(100);
setcolor(k);
rectangle(80+k,220+k,400+k,270+k);
}
outtextxy(200,300,"input S for second grade");
for(int b=3;b<13;b++)
{
delay(100);
setcolor(b);
rectangle(160+b,270+b,480+b,330+b);
}
char ch1=getch();
closegraph();
if(ch1==102)
{
mg.drawmap1();
mg.play1();
}
if (ch1==115)
{
mg.drawmap2();
mg.play2();
//mg.drawmap2();
//mg.play2();
}
showwindow4();
nosound();
showwindow3();
clrscr();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?