c语言小游戏

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
settextstyle(0,0,6);
outtextxy(50,200,"Let's play!!");
sleep(1);
}
/*开机动画*/
kjdh()
{
setbkcolor(1);
cleardevice();
setcolor(13);
}
n++;
}
}
/*目标小旗*/
mbxq(int x,int y)
{
setlinestyle(0,0,1);
setcolor(4);
moveto(x,y);
lineto(x,y-20);
lineto(250,400);
lineto(300,450);
lineto(580,200);
lineto(640,200);
setcolor(3);
rectangle(210,370,240,400);
rectangle(610,170,640,200);
lineto(x+10,y-20);
lineto(x,y-10);
}
/*地图1*/
map1()
{
setlinestyle(0,0,3);
setbkcolor(0);
setcolor(2);
moveto(50,480);
lineto(200,400);
{
x=random(640);
y=random(480);
z=random(16);
putpixel(x,y,z);
}
}
/*画旗*/
hq()
{
int i ;
setlinestyle(0,0,3);
setfillstyle(9,4);
floodfill(200,40,4);
for(i=0;i<307;i++)
{
settextstyle(0,0,4);
setcolor(i+12);
outtextxy(200,50,"Software");
setcolor(13);
outtextxy(0,0,"press 'w' or 's' for setting direction.");
outtextxy(0,30,"press 'space' for shooting,'Esc' to quit.");
}
/*倒计时*/
mbxq(225,370);
mbxq(625,170);
}
map2()
{
setlinestyle(0,0,3);
setbkcolor(0);
setcolor(2);
moveto(50,480);
lineto(200,400);
{
m=l ;
while(m<480)
{
line(1,m,640,m);
m=m+20 ;
}
}
}
/*艺术*/
ys()
{
float f,g ;
}
settextstyle(4,0,10);
setcolor(14);
outtextxy(225,50,"041");
setcolor(4);
settextstyle(1,0,8);
outtextxy(60,300,"We are heros");
outtextxy(225,100,"2");
sleep(1);
cleardevice();
setcolor(14);
outtextxy(225,100,"1");
sleep(1);
cleardevice();
setcolor(10);eto(350,100);
lineto(400,100);
lineto(450,450);
lineto(580,200);
lineto(640,200);
setcolor(3);
rectangle(360,70,390,100);
graph()
{
int gdriver,gmode ;
gdriver=DETECT ;
initgraph(&gdriver,&gmode,"");
}
/*艺术清屏*/
qp()
{
float l,m ;
setcolor(14);
for(l=1;l<=21;l=l+.02)
rectangle(610,170,640,200);
mbxq(375,70);
mbxq(625,170);
}
map3()
{
setlinestyle(0,0,3);
settextstyle(1,0,4);
for(i=1;i<230;i++)
{
delay(2000);
cleardevice();
outtextxy(i,200,"software");
outtextxy(450-i,260,"Excellent!!");
sleep(1);
setcolor(2);
setlinestyle(0,0,3);
circle(320,240,150);
sleep(1);
settextstyle(1,0,4);
setcolor(4);
outtextxy(80,230,"Hebei University of Technology");
setcolor(0);
line(x,i+1,x,i-4);
setcolor(14);
line(x,i,x,i-5);
delay(50);
}
for(i=1;i<90;i++)
settextstyle(0,0,6);
setcolor(11);
outtextxy(150,330,"World!!");
hq();
}
/*随机画点*/
hd2()
{
long int i,x,z,y ;
for(i=0;i<600000;i++)
hd();
ys();
qp();
sleep(1);
cleardevice();
setbkcolor(1);
settextstyle(0,0,4);
outtextxy(10,260,"Welcome to our game");
{
setcolor(i);
circle(x,y,i);
delay(2000);
setcolor(0);
circle(x,y,i);
setcolor(i);
settextstyle(4,0,6);
outtextxy(240,110,"0 4 1");
}
}
/*礼花*/
lh()
{
int x,y,i,n=0 ;
setcolor(14);
while(n<=6)
{
setlinestyle(0,0,3);
x=random(640);
y=random(100);
for(i=480;i>y;i--)
{
setcolor(14);
line(180,30,100,230);
setcolor(4);
line(180,30,500,30);
line(183,30,123,180);
line(120,180,440,180);
line(500,30,440,180);
setcolor(1);
outtextxy(60,260,"Best shooter");
}
hq();
hd2();
cleardevice();
setbkcolor(0);
setcolor(14);
ellipse(320,240,0,360,300,150);
#include<stdlib.h>
#include<graphics.h>
#include<stdio.h>
#include<math.h>
#include<dos.h>
int x,y,x1,y1,vx,vy,a,b,z,n,gk=1 ;
float t,i,m,jd=45 ;
/*图形初始化*/
sleep(1);
settextstyle(0,0,6);
for(i=320;i>1;i--)
{
delay(600);
setcolor(10);
line(i,1,i,479);
line(639-i,1,639-i,479);
{
setcolor(BLUE);
line(1,278-g/2,g,0);
line(637,200+g/2,637-g,478);
}
}
/*画点*/
hd()
{
int i,x,y,z ;
for(i=0;i<6000;i++)
{
x=random(640);
y=random(480);
z=random(16);
putpixel(x,y,z);
delay(100);
}
}
/*游戏说明*/
sm()
{
settextstyle(0,0,2);
outtextxy(225,100,"4");
sleep(1);
cleardevice();
setcolor(2);
outtextxy(225,100,"3");
sleep(1);
cleardevice();
setcolor(10);
setcolor(10);
for(f=1;f<=637;f=f+.2)
{
setcolor(3);
line(1,637-f/2,f,0);
line(637,f/2,637-f,478);
}
for(g=1;g<=478;g=g+.2)
ksyx()
{
sleep(2);
cleardevice();
settextstyle(0,0,31);
setcolor(13);
outtextxy(225,100,"5");
sleep(1);
cleardevice();
setcolor(14);
相关文档
最新文档