int x,y;x=30*i+15,y=30*j+15;
setcolor(color);
line(x+4,y+1,x+27,y+1);
line(x+4,y+7,x+27,y+7);
line(x+4,y+24,x+27,y+24);
line(x+4,y+30,x+27,y+30);
arc(x+4,y+4,90,270,3);
arc(x+27,y+4,270,90,3);
arc(x+4,y+27,90,270,3);
arc(x+27,y+27,270,90,3);
line(x+16,y+14,x+30,y+14);
line(x+16,y+15,x+30,y+15);
line(x+16,y+16,x+30,y+16);
line(x+16,y+17,x+30,y+17);
allcircle(i,j);
}
void map_water(int i,int j)
{
int x,y;x=30*i+15,y=30*j+15;
setfillstyle(1,9);
bar(x+1,y+1,x+30,y+30);
setfillstyle(1,7);
bar(x+14,y+1,x+17,y+30);
bar(x+1,y+14,x+30,y+17);
}
void map_steel(int i,int j)
{
int x,y;x=30*i+15,y=30*j+15;
setfillstyle(1,8);
bar(x+1,y+1,x+30,y+30);
setfillstyle(1,15);
bar(x+3,y+3,x+12,y+12);
bar(x+19,y+3,x+28,y+12);
bar(x+3,y+19,x+12,y+28);
bar(x+19,y+19,x+28,y+28);
}
void map_wall(int i,int j)
{
int x,y;x=30*i+15,y=30*j+15;
setfillstyle(1,13);
bar(x+1,y+1,x+30,y+30);
setcolor(15);
line(x+1,y+1,x+30,y+30);
line(x+1,y+30,x+30,y+1);
}
void end(void)
{
int i;
getch();
for(i=0;i<640;i++)
{
setcolor(3);
line(i,0,i,479);delay(2000);
}
closegraph();
printf("you killed %d enemy!\n",3-enemynum);
printf("Thank you very much!");
getch();
}
void blank(int i,int j)
{
int x,y;
x=30*i+15,y=30*j+15;
setfillstyle(1,7);
bar(x+1,y+1,x+30,y+30);
}
void map_border(int i,int j)
{
int x,y;x=30*i+15,y=30*j+15;
setfillstyle(1,8);
bar(x+1,y+1,x+30,y+30);
}
void map_base(int i,int j)
{
int x,y;x=30*i+15,y=30*j+15;
setcolor(15);
circle(x+15,y+15,10);
circle(x+11,y+11,2);
circle(x+19,y+11,2);
arc(x+15,y+15,225,315,6);
}
void control_shoot(int m,int map[15][15],int i)
{
switch(m)
{
case 5:shoot[i].life=0;
switch(shoot[i].way)
{
case UPWAY:map[(shoot[i].y-15)/30-1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30-1);break;
case DOWNWAY:map[(shoot[i].y-15)/30+1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30+1);break;
case LEFTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30-1]=0;blank((shoot[i].x-15)/30-1,(shoot[i].y-15)/30);break;
case RIGHTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30+1]=0;blank((shoot[i].x-15)/30+1,(shoot[i].y-15)/30);break;
}
break;
case 7:shoot[i].life=1;
break;
case 44:shoot[i].life=0;
enemy[0].life=0;enemynum--;
switch(shoot[i].way)
{
case UPWAY:map[(shoot[i].y-15)/30-1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30-1);break;
case DOWNWAY:map[(shoot[i].y-15)/30+1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30+1);break;
case LEFTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30-1]=0;blank((shoot[i].x-15)/30-1,(shoot[i].y-15)/30);break;
case RIGHTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30+1]=0;blank((shoot[i].x-15)/30+1,(shoot[i].y-15)/30);break;
}
break;
case 45:shoot[i].life=0;
enemy[1].life=0;enemynum--;
switch(shoot[i].way)
{
case UPWAY:map[(shoot[i].y-15)/30-1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30-1);break;
case DOWNWAY:map[(shoot[i].y-15)/30+1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30+1);break;
case LEFTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30-1]=0;blank((shoot[i].x-15)/30-1,(shoot[i].y-15)/30);break;
case RIGHTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30+1]=0;blank((shoot[i].x-15)/30+1,(shoot[i].y-15)/30);break;
}
break;
case 46:shoot[i].life=0;
enemy[2].life=0;enemynum--;
switch(shoot[i].way)
{
case UPWAY:map[(shoot[i].y-15)/30-1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30-1);break;
case DOWNWAY:map[(shoot[i].y-15)/30+1][(shoot[i].x-15)/30]=0;blank((shoot[i].x-15)/30,(shoot[i].y-15)/30+1);break;
case LEFTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30-1]=0;blank((shoot[i].x-15)/30-1,(shoot[i].y-15)/30);break;
case RIGHTWAY:map[(shoot[i].y-15)/30][(shoot[i].x-15)/30+1]=0;blank((shoot[i].x-15)/30+1,(shoot[i].y-15)/30);break;
}
break;
}
}