Brock.cpp
资源名称:LwGame2.0.rar [点击查看]
上传用户:semy2100
上传日期:2013-01-22
资源大小:3633k
文件大小:3k
源码类别:
射击游戏
开发平台:
Visual C++
- /********************************************************************
- * 空运爆发 *
- * Version 2.0 *
- * 本游戏全部代码由: *
- * 冲天实验室 梁锋 编写 *
- * 邮箱:lenwine@126.com *
- * bbs: http://free2.e-168.cn/lenwind (正在开发中...) *
- **********************************************************************/
- #include "stdafx.h"
- Brock::Brock(Manager *mgr,int xv,int yv):ShootPlane(mgr,xv,yv)
- {
- Work=true;
- spx=0;
- spy=0;
- }
- void Brock::Update()
- {
- ShootPlane::Update();
- if(leaveline()&&y>=Manager::Imgtall)
- Work=false;
- }
- void Brock::Shoot()
- {
- if(mManager->Time-EndShoot<Bomb::GetShoot(bombStyle))
- return;
- mManager->EnermyShoot(this);
- EndShoot=mManager->Time;
- }
- BrockA::BrockA(Manager *mgr,int xv,int yv):Brock(mgr,xv,yv)
- {
- bx=421;
- by=0;
- Bitlong=55;
- Bittall=78;
- rx=2;
- ry=3;
- rlong=58;
- rtall=81;
- alive=10;
- spy=2;
- AWork=WF;
- bombStyle=Bomb::ENERMY_BOMBO;
- SetEndShoot();
- ChangePlace();
- }
- void BrockA::RunOther()
- {
- AWork=(AWORK)(rand()%2);
- }
- void BrockA::Update()
- {
- Brock::Update();
- if(alive<=0)return;
- switch(AWork)
- {
- case WL:
- x--;
- if(x<0)
- {
- x=0;
- AWork=WF;
- }
- break;
- case WR:
- x++;
- if(x+Bitlong>Manager::Imglong)
- {
- x=Manager::Imglong-Bitlong;
- AWork=WF;
- }
- break;
- }
- if(rand()<300)
- RunOther();
- }
- BrockB::BrockB(Manager *mgr,int xv,int yv):Brock(mgr,xv,yv)
- {
- bx=537;//机身
- by=3;
- Bitlong=43;
- Bittall=43;
- rx=2;//碰撞检测,所有都一样
- ry=3;
- rlong=46;
- rtall=48;
- /*这些都是新增了飞机*/
- alive=2;
- spy=5;
- bombStyle=Bomb::ENERMY_BOMBS;
- SetEndShoot();
- ChangePlace();
- }
- BrockC::BrockC(Manager *mgr,int xv,int yv):Brock(mgr,xv,yv)
- {
- bx=2;
- by=417;
- Bitlong=96;
- Bittall=123;
- rx=3;
- ry=5;
- rlong=100;
- rtall=129;
- alive=5;
- spy=3;
- bombStyle=Bomb::ENERMY_BOMBT;
- SetEndShoot();
- ChangePlace();
- }
- BrockD::BrockD(Manager *mgr,int xv,int yv) : Brock(mgr,xv,yv)
- {
- bx=348;
- by=0;
- Bitlong=40;
- Bittall=50;
- /*这些都是新增了飞机*/
- rx=7;
- ry=5;
- rlong=30;
- rtall=35;
- alive=2;
- spy=3;
- bombStyle=Bomb::ENERMY_BOMBF;
- SetEndShoot();
- ChangePlace();
- }
- BrockE::BrockE(Manager *mgr,int xv,int yv) : Brock(mgr,xv,yv)
- {
- bx=261;
- by=424;
- Bitlong=67;
- Bittall=120;
- /*第一个 敌机王*/
- rx=3;
- ry=2;
- rlong=70;
- rtall=125;
- alive=8;
- spy=3;
- bombStyle=Bomb::ENERMY_BOMBG;
- SetEndShoot();
- ChangePlace();
- }
- BrockF::BrockF(Manager *mgr,int xv,int yv) : Brock(mgr,xv,yv)
- {
- bx=388;
- by=0;
- Bitlong=31;
- Bittall=50;
- /*碰撞的X,Y*/
- rx=3;
- ry=5;
- rlong=35;
- rtall=56;
- alive=3;
- spy=2;
- bombStyle=Bomb::ENERMY_BOMBI;
- SetEndShoot();
- ChangePlace();
- }