Bomb.cpp
资源名称:LwGame2.0.rar [点击查看]
上传用户:semy2100
上传日期:2013-01-22
资源大小:3633k
文件大小:6k
源码类别:
射击游戏
开发平台:
Visual C++
- /********************************************************************
- * 空运爆发 *
- * Version 2.0 *
- * 本游戏全部代码由: *
- * 冲天实验室 梁锋 编写 *
- * 邮箱:lenwine@126.com *
- * bbs: http://free2.e-168.cn/lenwind (正在开发中...) *
- **********************************************************************/
- #include "stdafx.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- Bomb::Bomb(Manager *mgr,int xv,int yv,double memsx,double memsy):MemberStatus(mgr,xv,yv)
- {
- spx=memsx;
- spy=memsy;
- blow_up_value=32;
- blow_up_current=-1;
- };
- int Bomb::GetShoot(BOMBSTYLE bombStyle)
- {
- switch(bombStyle)//
- {
- case OPERATOR_SHOOT:
- return 150;
- case OPERATOR_NOSHOOT:
- return 300;
- case OPERATOR_ROUND_SHOOT:
- return 200;
- case ENERMY_BOMBO:
- return 2000;
- case ENERMY_BOMBS:
- return 500;
- case ENERMY_BOMBT:
- return 1000;
- case ENERMY_BOMBF:
- return 500;
- case ENERMY_BOMBG:
- return 900;
- case ENERMY_BOMBH:
- return 700;
- case ENERMY_BOMBI:
- return 2600;
- case ENERMY_BOMBJ:
- return 1500;
- }
- return 0;
- }
- void Bomb::OperatorStatus(double sd,int ad)
- {
- double g=Manager::PI*ad/180;
- spx+=sd*cos(g);
- spy+=-sd*sin(g);
- }
- void Bomb::Update()
- {
- if(leaveline())
- Work=false;
- else if(alive<=0)
- {
- if(++blow_up_current==0)
- {
- bx=0;
- by=83;
- Bitlong=32;
- Bittall=32;
- spx=0;
- spy=0;
- }else if(blow_up_current>=blow_up_value)
- Work=false;
- else
- {
- bx=32*(blow_up_current/4);
- }
- }
- MemberStatus::Update();
- }
- //shoottt
- OperatorShoot::OperatorShoot(Manager *mgr,int xv,int yv,double memsx,double memsy):Bomb(mgr,xv,yv,memsx,memsy)
- {
- Bomb::spx=0;
- Bomb::spy=-35;
- /* 这里设置 长红-004 攻击力、速度、直向 */
- MemberStatus::bx=29;
- MemberStatus::by=0;
- MemberStatus::Bitlong=3;
- MemberStatus::Bittall=13;
- rx=0;
- ry=0;
- rlong=3;
- rtall=9;
- ChangePlace();
- };
- //OperatorNoShoot
- OperatorNoShoot::OperatorNoShoot(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad):Bomb(mgr,xv,yv,memsx,memsy)
- {
- Ad=ad;
- nAd=3;
- /* 这里设置 旋风-520 攻击力、速度、方向 */
- MemberStatus::bx=177;
- MemberStatus::by=1;
- //MemberStatus::Bitlong=4;
- //MemberStatus::Bittall=8;
- MemberStatus::Bitlong=3;
- MemberStatus::Bittall=21;
- rx=1;
- ry=0;
- rlong=3;
- rtall=7;
- //rlong=2;
- //rtall=6;
- xa=xv;
- area=6;
- //area=1;
- ChangePlace();
- };
- void OperatorNoShoot::Update()
- {
- if(alive>0)
- {
- x=xa;
- spx=area*cos(Ad*Manager::PI/180);
- spy=-10-3;//设置速度
- Ad+=nAd;
- area+=3;
- }
- Bomb::Update();
- }
- OperatorRoundShoot::OperatorRoundShoot(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad):Bomb(mgr,xv,yv,0,0)
- {
- MemberStatus::bx=36;//子弹X
- MemberStatus::by=0;//子弹Y
- MemberStatus::Bitlong=5;
- MemberStatus::Bittall=5;
- /* 这里设置 邪神-180 攻击力、速度、 */
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- shootpower=1;
- ChangePlace();
- OperatorStatus(15,ad);//设置 邪神-180 速度
- };
- //EnermyBombO
- EnermyBombO::EnermyBombO(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad):Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=30;//子弹X
- MemberStatus::by=25;//子弹Y
- MemberStatus::Bitlong=8;
- MemberStatus::Bittall=8;
- /*为了记忆,我将这架敌机起名为 红星-F007 主要运作:
- 发弹、在发弹期间有时会改变方向*/
- rx=2;
- ry=2;
- rlong=4;
- rtall=4;
- ChangePlace();
- OperatorStatus(3,ad);//设置这架敌机发弹的速度
- };
- //EnermyBombS
- EnermyBombS::EnermyBombS(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad):Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是x
- MemberStatus::by=13;//子弹y
- MemberStatus::Bitlong=7;
- MemberStatus::Bittall=7;
- /*为了记忆,我将这敌机起名为 炸弹-F002 主要运作:
- 发弹、在发弹期间不会改变方向*/
- rx=1;
- ry=1;
- rlong=5;
- rtall=5;
- ChangePlace();
- OperatorStatus(6,ad);//设置发弹速度
- };
- //EnermyBombT
- EnermyBombT::EnermyBombT(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad):Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是
- MemberStatus::by=20;//子弹
- MemberStatus::Bitlong=5;//宽
- MemberStatus::Bittall=5;//高
- /*为了记忆,我将这敌机起名为 冲动-F008 主要运作:
- 发弹、在发弹期间不会改变方向*/
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- ChangePlace();
- OperatorStatus(7,ad);//设置冲动速度
- };
- //EnermyBombF
- EnermyBombF::EnermyBombF(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad) : Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是
- MemberStatus::by=20;//子弹
- MemberStatus::Bitlong=5;//宽
- MemberStatus::Bittall=5;//高
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- ChangePlace();
- OperatorStatus(7,ad);//设置速度
- };
- EnermyBombG::EnermyBombG(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad) : Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=43;//这里是
- MemberStatus::by=465;//子弹
- MemberStatus::Bitlong=7;//宽
- MemberStatus::Bittall=7;//高
- /*王*/
- rx=2;
- ry=2;
- rlong=50;
- rtall=470;
- ChangePlace();
- OperatorStatus(7,ad);//设置速度
- };
- EnermyBombH::EnermyBombH(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad) : Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是
- MemberStatus::by=20;//子弹
- MemberStatus::Bitlong=5;//宽
- MemberStatus::Bittall=5;//高
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- ChangePlace();
- OperatorStatus(7,ad);//设置速度
- };
- EnermyBombI::EnermyBombI(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad) : Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是
- MemberStatus::by=20;//子弹
- MemberStatus::Bitlong=5;//宽
- MemberStatus::Bittall=5;//高
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- ChangePlace();
- OperatorStatus(7,ad);//设置速度
- };
- EnermyBombJ::EnermyBombJ(Manager *mgr,int xv,int yv,double memsx,double memsy,int ad) : Bomb(mgr,xv,yv,memsx,memsy)
- {
- MemberStatus::bx=29;//这里是
- MemberStatus::by=20;//子弹
- MemberStatus::Bitlong=5;//宽
- MemberStatus::Bittall=5;//高
- rx=1;
- ry=1;
- rlong=3;
- rtall=3;
- ChangePlace();
- OperatorStatus(7,ad);//设置速度
- };