刚写的一个射击游戏不知道发到这里是不是有点低级
#include <stdio.h>#include <conio.h>
#include <iostream.h>
void shoot()
{int x1,y1;
int m1,n1;
x1=5;y1=10;
for( ;x1<50;)
{m1=x1;
n1=y1;
int a,b,c;
gotoxy(x1++,y1);
cout<<"*";
for(a=0;a<=50;a++)
for(b=0;b<=70;b++)
for(c=0;c<=100;c++) ;
gotoxy(m1,n1);
cout<<" ";}
}
void delay()
{int a,b,c;
for(a=0;a<=350;a++)
for(b=0;b<=400;b++)
for(c=0;c<=400;c++) ;
}
void main()
{
int i;
int x2,y2;
int m2,n2;
x2=30;y2=30;
gotoxy(20,5);
cout<<"type blackspace";
int count=0;
gotoxy(5,5);
cout<<"count: "<<count;
for(i=1;i<=10000;i++)
{ gotoxy(30,10);
cout<<"*";
for(y2=20;y2>=0;)
{ m2=x2;
n2=y2;
gotoxy(x2,y2--);
cout<<"*";
delay();
gotoxy(m2,n2);
cout<<" ";
gotoxy(30,10);
cout<<"*";
while(kbhit())
{if(getch()==32)
shoot();
if(y2==10)
count++;
gotoxy(5,5);
cout<<"count: "<<count;
}
}
}
}