aboutsummaryrefslogtreecommitdiff
path: root/towernbullet.h
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-02-26 13:23:31 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-02-26 13:23:31 +0000
commite7174e25c6a6aef85014c1af3adf698e8446969b (patch)
tree2a82056e7f459adac7256060bb58b3fa8bfc414f /towernbullet.h
parentb61ca302cc935326e9adabd22a7cb35684ced666 (diff)
downloadbullet-lab-remix-e7174e25c6a6aef85014c1af3adf698e8446969b.tar.xz
M resources/b_inter.png
M trunk/CHANGELOG.TXT M trunk/VERSION.TXT M trunk/background.h M trunk/global.h M trunk/hge/sound.cpp M trunk/levels.h M trunk/main.cpp M trunk/towernbullet.h
Diffstat (limited to 'towernbullet.h')
-rw-r--r--towernbullet.h71
1 files changed, 63 insertions, 8 deletions
diff --git a/towernbullet.h b/towernbullet.h
index 52fbe38..83abca4 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -89,6 +89,7 @@ int CreateBullet2(double x,double y,double bs,double rad,bool eff=false,bool inv
//bullet[i].bulletspr=new hgeSprite(SprSheet,0,0,24,24);
//bullet[i].bulletspr->SetColor(0x80FFFFFF);
bullet[i].scollable=true;
+ bullet[i].collable=true;
bullet[i].bulletaccel=bullet[i].limv=0;
bullet[i].scale=1;
//bullet[i].bulletspr->SetHotSpot(12,12);
@@ -403,15 +404,18 @@ void ProcessBullet2(int i)
bullet[i].bullettype=0;
return;
}
- if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)
+ if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable)
//If collision is detected or the bullet flys out of screen, delete it.
{
- ++coll,scminus+=10000,Mult_BatClear();
- bullet[i].exist=false;
- bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
- bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
- bullet[i].dist=0;
- bullet[i].bullettype=0;
+ ++coll,scminus+=10000,Mult_BatClear();bullet[i].collable=false;
+ if(!bullet[i].inv)
+ {
+ bullet[i].exist=false;
+ bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
+ bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
+ bullet[i].dist=0;
+ bullet[i].bullettype=0;
+ }
return;
}
else
@@ -1922,7 +1926,6 @@ public:
}
};
class WOP
-//module:
{
private:
int trail[200];//Pointer to bullet[] in this trail
@@ -1969,3 +1972,55 @@ public:
if (OutOfBound())active=false;
}
};
+class SimpleThing
+{
+private:
+ vector2d center;
+ int step,cnt;
+ double rad,dly,lr,ra;
+ SimpleBullet b[500];
+ double r[500],mr[500];
+ bool create,rot;
+public:
+ void Init(vector2d _ctr)
+ {
+ center=_ctr;step=cnt=dly=lr=ra=0;
+ create=true;rot=false;
+ }
+ void Update(bool rv)
+ {
+ dly+=hge->Timer_GetDelta();
+ if(dly>0.2&&create)
+ {
+ dly=0;
+ for(int i=0;i<10;++i)
+ {
+ b[cnt].bulletpos=center;
+ b[cnt].aC=blue;b[cnt].aC2=COLOR_COUNT;
+ r[cnt/10]=0;mr[cnt/10]=(lr+=2);
+ if (lr>620)create=false;
+ ++cnt;
+ }
+ }
+ bool all=!create;
+ if(!rot)
+ for(int i=0;i<cnt;++i)
+ {
+ b[i].bulletpos=vector2d(center.x+r[i/10]*cos(i/10*pi/12+pi/5*(i%10)),center.y+r[i/10]*sin(i/10*pi/12+pi/5*(i%10)));
+ if(r[i/10]<mr[i/10])r[i/10]+=(LOWFPS?17:1)*0.01,all=false;
+ else r[i/10]=mr[i/10];
+ b[i].Update_SimpBul();
+ }
+ if(all||rot)
+ {
+ rot=true;
+ rv?rad+=(LOWFPS?17:1)*ra:rad-=(LOWFPS?17:1)*ra;
+ if(ra<pi/7200)ra+=(LOWFPS?17:1)*pi/630000000.0f;
+ for(int i=0;i<cnt;++i)
+ {
+ b[i].bulletpos=vector2d(center.x+r[i/10]*cos(i/10*pi/12+rad+pi/5*(i%10)),center.y+r[i/10]*sin(i/10*pi/12+rad+pi/5*(i%10)));
+ b[i].Update_SimpBul();
+ }
+ }
+ }
+};