summaryrefslogtreecommitdiff
path: root/towernbullet.h
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-06 02:59:55 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-06 02:59:55 +0000
commitb3c3e0348f19125b5123d6f5c87e2cc91fd0172f (patch)
tree133bf1701f352b2687689fd14bf90bed6f256f37 /towernbullet.h
parent6cb0520416cb69d0461d62651eb1fbf48991d9cb (diff)
downloadbullet-lab-remix-b3c3e0348f19125b5123d6f5c87e2cc91fd0172f.tar.xz
Make multiplier system function, do some clean-ups.
Diffstat (limited to 'towernbullet.h')
-rw-r--r--towernbullet.h44
1 files changed, 19 insertions, 25 deletions
diff --git a/towernbullet.h b/towernbullet.h
index 15899ac..38c55e4 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -8,12 +8,6 @@
#include "effects.h"
//static const char* TOWERNBULLET_H_FN="towernbullet.h";
-void DirectBullet(Bullet &a,double rad)
-{
- a.bulletdir.x=cos(rad);
- a.bulletdir.y=sin(rad);
- a.dist=1;
-}
void RenderAlter(vector2d p,TColors ca,TColors cb,double rot=0,double scl=1)
{
float x,y,w,h;
@@ -799,6 +793,7 @@ void ProcessBullet255(int i)
double dis=GetDist(bullet[i].bulletpos,playerpos);
if (dis<=6||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600)
{
+ score+=mult*100;
bullet[i].exist=false;
bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
@@ -1317,7 +1312,7 @@ void ProcessTower8()
if (Dis8ref)
{
if (tower[i].towerpos.y<300)
- DirectBullet(bullet[pnt],-pi/2);else DirectBullet(bullet[pnt],pi/2);
+ bullet[pnt].setdir(-pi/2);else bullet[pnt].setdir(pi/2);
}
if (tower[i].curshotcount==tower[i].shotcount)
tower[i].tdir=bullet[pnt].bulletdir;
@@ -1378,6 +1373,22 @@ private:
hgeDistortionMesh *graphic;
int Res;
vector2d data1[MaxRes],data2[MaxRes];
+ double GetDist()
+ {
+ double res=99999.9999f;
+ double tres=99999.9999f;
+ for (int i=0;i<Res-1;++i)
+ {
+ vector2d sa,sb;
+ sa=data1[i]+RenCtr;sb=data1[i+1]+RenCtr;
+ tres=GetDistSeg(sa,sb,playerpos);
+ sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr;
+ if(GetDistSeg(sa,sb,playerpos)<tres)
+ tres=GetDistSeg(sa,sb,playerpos);
+ if (tres<res)res=tres;
+ }
+ return res;
+ }
public:
bool EnableColl;
vector2d RenCtr;
@@ -1431,23 +1442,6 @@ public:
graphic->SetColor(Res-1,0,color);graphic->SetColor(Res-1,1,color);
--Res;
}
- double GetDist()
- {
- double res=99999.9999f;
- double tres=99999.9999f;
- //Initalize: 999'99.9'999
- for (int i=0;i<Res-1;++i)
- {
- vector2d sa,sb;
- sa=data1[i]+RenCtr;sb=data1[i+1]+RenCtr;
- tres=GetDistSeg(sa,sb,playerpos);
- sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr;
- if(GetDistSeg(sa,sb,playerpos)<tres)
- tres=GetDistSeg(sa,sb,playerpos);
- if (tres<res)res=tres;
- }
- return res;
- }
void Process()
{
Render();
@@ -1733,7 +1727,7 @@ public:
void init()
{
stage=0;rad1=rad2=srad;elasp=0.0f;ccnt=0;
- for (int i=0;i<cnt;++i)Bul[i]=&bullet[CreateBullet8(400,300,0,false)],DirectBullet(*Bul[i],srad),Bul[i]->scale=0.01;
+ for (int i=0;i<cnt;++i)Bul[i]=&bullet[CreateBullet8(400,300,0,false)],Bul[i]->setdir(srad),Bul[i]->scale=0.01;
Bul[0]->bulletspeed=2;Bul[0]->scale=1;
}
void stage0()