From 8635e927b86a6336d887f19c776579bb3f715b32 Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Sat, 18 Jan 2014 02:29:44 +0000 Subject: M trunk/levels.h M trunk/main.cpp M trunk/towernbullet.h --- towernbullet.h | 57 ++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 17 deletions(-) (limited to 'towernbullet.h') diff --git a/towernbullet.h b/towernbullet.h index cef4923..b38442f 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -1431,6 +1431,7 @@ public: bool EnableColl; vector2d RenCtr; int collbrk,scollbrk; + void SetRes(int _Res){Res=_Res;} void Render() { graphic->Render(RenCtr.x,RenCtr.y); @@ -1484,11 +1485,18 @@ public: double res=99999.9999f; double tres=99999.9999f; //Initalize: 999'99.9'999 - for (int i=1;iSetColor(0x80FFFFFF); @@ -1560,12 +1570,14 @@ void ProcessBullet2(Bullet &xbul) { if (xbul.bulletspeed=900||xbul.bulletpos.y<=-100||xbul.bulletpos.y>=700) { xbul.exist=false; @@ -1573,6 +1585,13 @@ void ProcessBullet2(Bullet &xbul) xbul.bulletdir.x=xbul.bulletdir.y=0; xbul.bullettype=0; }*/ + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7) + //If collision is detected or the bullet flys out of screen, delete it. + { + ++coll,scminus+=10000,Mult_BatClear(); + return; + } + if (dis<=16&&xbul.scollable)++semicoll,++dsmc,xbul.scollable=false,SCEffect_Attatch(); xbul.bulletspr->RenderEx(xbul.bulletpos.x+7.2,xbul.bulletpos.y+7.2,0,0.5); } //"Noname" @@ -1846,14 +1865,18 @@ public: line.SetTexture(SprSheet,0,264,248,8); line.RenCtr.x=line.RenCtr.y=0; line.EnableColl=false; - CreateBullet2(headb,a.x,b.x,2,0); - double theta=(a.y-b.y,a.x-b.x); - vector2d a2=vector2d(a.x+0.5*sin(theta),a.y+0.5*cos(theta)); - vector2d b2=vector2d(b.x+0.5*sin(theta),b.y+0.5*cos(theta)); - line.InsPoint(a,a2,0x33CCFF); - while(line.InsPoint(b,b2,0x33CCFF)); + CreateBullet2(headb,a.x,b.x,6,0); headb.redir(b); + double theta=(a.y-b.y,a.x-b.x); + vector2d a2=vector2d(a.x+4*sin(theta),a.y+4*cos(theta)); + vector2d b2=vector2d(b.x+4*sin(theta),b.y+4*cos(theta)); + //line.InsPoint(a,a2,0xCC33CCFF); + //while(line.InsPoint(b,b2,0xCC33CCFF)); + line.SetRes(3); + line.Setdata(0,a,a2,0xCC33CCFF); + for (int i=1;i<80;++i)line.Setdata(i,b,b2,0xCC33CCFF); active=true; + lifetime=0; } void Update() { -- cgit v1.2.3