我要做一个导弹打飞机的游戏,请大家帮我检查一下代码

来源:百度知道 编辑:UC知道 时间:2024/06/30 06:54:20
问题是,每当我安下一个键之后程序就终止了,不会显示导弹打飞机的过程
代码请看下一个提问

飞机动画程序如下,务必在tc目录下运行此程序。最后按ESC键退出图形界面。
#include<graphics.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<alloc.h>
#define ESC 0x1b
void InstallGraph(void);
void DrawGun(void);
void DrawPlan(void);
void DrawStar(void);
void *buf;

int x0=300;
int y0=340;
int width1=5;
int width2=20;
int height=25;
int y1=8;
int y2=15;
int y3=23;
int y4=38;
int main()
{
int size;
int i=0;
int key;
int station;
InstallGraph();
setbkcolor(BLACK);
cleardevice();
setcolor(BLUE);
outtextxy(80,100,"Ready!...Any key to SET OFF !!!");
DrawGun();
getch();
cleardevice();
DrawGun();
DrawPlan();
DrawStar();
setcolor(LIGHTRED);
do
{
putimage(x0-width2,y0-height-3*width1-i