\-/
V
*/
int isExist;
int x,y;//position of the head
int dx,dy;
int Blood,FullBlood;
int ShotSpeed,LastShotTime;
int MoveSpeed;
int LastMoveTime;
int Score,Money;
UFO{
if(BossFlag&&!Added)
UFOAddBlood+=100,UFOAddShotSpeed+=100,UFOAddMoveSpeed+=100,Added=1;
if(!BossFlag&&Added)
UFOAddBlood-=100,UFOAddShotSpeed-=100,UFOAddMoveSpeed-=100,Added=0;
isExist=1;
x=0,y=rand%(WINDOWW-4)+4;//Must be in the screen
FullBlood=rand%300+100+UFOAddBlood;
Blood=FullBlood;
ShotSpeed=rand%1000+UFOAddShotSpeed;
/*Move 1 block every 1000-MoveSpeed ms*/
MoveSpeed=rand%600+300+UFOAddMoveSpeed;
LastMoveTime=LastShotTime=-INF;
dx=1,dy=0;
Score=FullBlood/30+((clock-BEGINTIME)/10000);
Money=MoveSpeed/100.0+FullBlood/100.0;
}
/*effects when being hit*/
void Flash{
/*the head is sure to be in the screen so we needn\'t check*/
if(!isExist)
return;
if(x>0&&x<WINDOWC)
TP(x,y,fpurple+bwhite,\'V\');
if(x-1>0&&x-1<WINDOWC)
TP(x-1,y-1,fpurple+bwhite,"\\-/");
//Sleep(100);
if(x>0&&x<WINDOWC)
TP(x,y,fpurple+bblack,\'V\');
if(x-1>0&&x-1<WINDOWC)
TP(x-1,y-1,fpurple+bblack,"\\-/");
}
/*Check if hit only on the body*/
bool Hit(int tx,int ty){
return (tx==x&&ty==y)||
(tx==x-1&&ty>=y-1&&ty<=y+1);
}
/*To check if it will hit another UFO*/
void BloodRefresh(int NewX,int NewY){
/*To appear gradually, we should check the position*/
if(x-2>=0){
TP(x-2,y-1,OC," ");
if(isExist)
if(NewX-2<WINDOWC){
/*Round up*/
int FullBlock=(Blood*3+FullBlood-1)/FullBlood; //Number of "@"
int EmptyBlock=3-FullBlock; //Number of "O"
int BloodColor=ConstBloodColor[FullBlock];
/*Print the blood line*/
for(int i=1;i<=FullBlock;i++)
TP(NewX-2,NewY-2+i,BloodColor+bblack,\'@\');
for(int i=1;i<=EmptyBlock;i++)
TP(NewX-2,NewY-2+FullBlock+i,fgray+bblack,\'O\');
}
}
/*Print the blood/fullblood number*/
/*Due to %06d we can\'t use TP*/
if(x-3>=0){
TP(x-3,y-4,OC," ");
if(isExist){
if(NewX-3<WINDOWC){
gto(NewX-3,NewY-4),color(fcyan+bblack),printf("%04d",Blood);
TP(NewX-3,NewY,fcyan+bblack,\'/\');
gto(NewX-3,NewY+1),color(fcyan+bblack),printf("%04d",FullBlood);
}
}
}
if(x-3>=WINDOWC)
isExist=0;
}
/*Clear the shape after it died*/
void ClearPrint{
BloodRefresh(x,y);
if(x-1>=0&&x-1<WINDOWC)
TP(x-1,y-1,OC," ");
if(x>=0&&x<WINDOWC)
TP(x,y,OC,\' \');
}
void Shot{
int t=clock;
if(!ShotSpeed||LastShotTime>=t-(5000-ShotSpeed))
return;
LastShotTime=t;
if(x>0){
Bullet *tmp=new Bullet(1,x+1,y,2,1,0);
Ammo.insert(tmp);
}
}
};
/*It is similar to set<Bullet*> in struct Plane*/
set<UFO*> Enemy;
bool UFOCrash(int,int);
bool UFOCrash(UFO,int,int,set<UFO*>::iterator);
/*Move the plane to a new place*/
void UFOMovePrint(UFO &me,set<UFO*>::iterator id){
int t=clock;
if(me.LastMoveTime>=t-(1000-me.MoveSpeed))
return;
me.LastMoveTime=t;
/*Change the direction*/
if(rand%3==0)
me.dy=ConstNewDy[rand()%3];
int NewX=me.x+me.dx,NewY=me.y+me.dy;
if(UFOCrash(me,NewX,NewY,id)||NewY-4<0||NewY+4>=WINDOWW)//||NewX<0||NewY-4<0||NewX>=WINDOWC||NewY+4>=WINDOWW){
for(int i=0;i<3;i++){
me.dy=ConstNewDy[rand()%3];
NewX=me.x+me.dx,NewY=me.y+me.dy;
if(!(UFOCrash(me,NewX,NewY,id)||NewY-4<0||NewY+4>=WINDOWW))//||NewX<0||NewY-4<0||NewX>=WINDOWC||NewY+4>=WINDOWW))
break;
}
if(UFOCrash(me,NewX,NewY,id)||NewY-4<0||NewY+4>=WINDOWW)//||NewX<0||NewY-4<0||NewX>=WINDOWC||NewY+4>=WINDOWW)
return;
//TP(me.x,me.y,OC,\' \');
if(NewX<WINDOWC){
TP(me.x,me.y,fwhite+flight+bblack,\' \');
if(me.isExist) TP(NewX,NewY,fwhite+flight+bblack,\'V\');
- 顺玩游戏 顺网游戏中心
- windows7网络和共享中心打不开 win7系统网络和共享中心打不开
- 森林控制台代码能给好友使用吗 森林控制台作弊码大全
- 汤尼简介 汤尼国际语言中心培训
- 广州汽车维修培训中心 广州汽车维修专业学校
- 天津流浪猫狗收容中心 天津狗狗网
- 英雄联盟头像领取中心 LOL领取头像
- 阿里巴巴将与俄罗斯出口中心联合推出俄产品对华出口项目
- 亚马逊电话 400 卓越亚马逊客服中心电话
- 12306铁路客户服务电话 全国铁路客户服务中心 12306官网
特别声明:本站内容均来自网友提供或互联网,仅供参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
