From a404f537e1f260040063b65461213800c896e15c Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Mon, 3 Mar 2014 08:52:12 +0000 Subject: New levels and laser rewrite. Bring back a level and remove all commented levels. --- towernbullet.h | 172 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 127 insertions(+), 45 deletions(-) (limited to 'towernbullet.h') diff --git a/towernbullet.h b/towernbullet.h index 854d161..1440bc1 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -1404,40 +1404,12 @@ public: //Initalize: 999'99.9'999 for (int i=0;i0&&xbul.bulletspeedTimer_GetFPS()); + if (xbul.bulletaccel<0&&xbul.bulletspeed>xbul.limv)xbul.bulletspeed+=xbul.bulletaccel*(1000.0f/hge->Timer_GetFPS()); xbul.bulletpos.x-=xbul.bulletspeed*(xbul.bulletdir.x/xbul.dist)/20*(1000.0f/hge->Timer_GetFPS()); xbul.bulletpos.y-=xbul.bulletspeed*(xbul.bulletdir.y/xbul.dist)/20*(1000.0f/hge->Timer_GetFPS()); double dis=GetDist(xbul.bulletpos,playerpos); - if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&colchk) + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&colchk&&xbul.collable) { - ++coll,scminus+=10000,Mult_BatClear(); + ++coll,scminus+=10000,Mult_BatClear();xbul.collable=false; return; } if (dis<=16&&xbul.scollable)++semicoll,++dsmc,xbul.scollable=false,SCEffect_Attatch(); @@ -1521,8 +1494,8 @@ public: untitledlas.Init(); this->x=x,this->y=2;color=_color; CreateBullet2(untitledbul,x,2,0,3*pi/2); - untitledbul.bulletaccel=0.0001; - untitledbul.limv=1; + untitledbul.bulletaccel=0.0005; + untitledbul.limv=2;untitledbul.collable=true; las=false; reverse=false; done=false; @@ -1540,7 +1513,7 @@ public: ProcessBullet2(untitledbul),x=untitledbul.bulletpos.x,y=untitledbul.bulletpos.y; else untitledlas.EnableColl=true, - untitledlas.Process(); + untitledlas.Process();//printf("%lf\n",untitledlas.GetDist()); if (!untitledbul.exist)y=-1; if (y>pos&&!done&&!las) { @@ -1571,17 +1544,18 @@ public: } if (las) { - untitledlas.RenCtr=vector2d(x,y); - untitledlas.Render(); + untitledlas.RenCtr=vector2d(x+7.2,y+7.2); + untitledlas.Render();untitledlas.EnableColl=true; + untitledlas.Process();printf("%lf\n",untitledlas.GetDist()); if (!reverse) { - if (range1=r1lim&&range2Timer_GetFPS()),range2=range1; + if (range1>=r1lim&&range2Timer_GetFPS()); if (range2>=r2lim)reverse=true; } else { - if (range2>=r1lim)range2-=0.1;else range1-=0.2,range2=range1; + if (range2>=r1lim)range2-=0.1*(1000.0/hge->Timer_GetFPS());else range1-=0.2*(1000.0/hge->Timer_GetFPS()),range2=range1; if (range1<=2)las=false,done=true; } for (int i=0;i<60;++i) @@ -1846,6 +1820,114 @@ public: if (OutOfBound())active=false; } }; +class BTail +{ +//devide the screen into a 16*12 matrix, put random colored bullets, arranged +//in the shape of the snake, on to it. +//^Maybe this description is too bad to understand. See the code. +//Partly based on class WOP +private: + class Pile + { + private: + Bullet* pb[200]; + int matrixx,matrixy,progress,cnt; + double brk;TColors color; + public: + int getProgress(){return progress;} + void create(int _x,int _y,TColors _col) + { + matrixx=_x;matrixy=_y;color=_col; + progress=1;cnt=0; + } + void update() + { + if(!progress)return; + if(progress<10) + { + brk+=hge->Timer_GetDelta(); + if(brk>0.03) + { + brk=0;if(progress++>5)return (void)(progress=10); + for(int i=0;i<10;++i) + { + vector2d ran=vector2d(rand()%50+matrixx*50,rand()%50+matrixy*50); + pb[cnt++]=&bullet[CreateBullet2(ran.x,ran.y,0,0,true)]; + pb[cnt-1]->alterColor=color; + } + } + } + else + { + brk+=hge->Timer_GetDelta(); + if(brk>0.03) + { + bool alldone=true; + for(int i=0;ilifetime>1) + { + BulletEffect_Death(*pb[i],ColorToDWORD(color)); + pb[i]->exist=false;pb[i]=0; + } + else alldone=false; + } + } + if(alldone)progress=0; + } + } + } + }; + Pile piles[30]; + bool tactive; + int listx[30],listy[30],cnt; + TColors pcolor; + bool check(int x,int y) + { + if(x<0||x>15)return false; + if(y<0||y>12)return false; + for(int i=0;i