www.gusucode.com > VC++游戏雷霆战机源代码-源码程序 > VC++游戏雷霆战机源代码-源码程序\code\EnemyBullet.cpp
// EnemyBullet.cpp: implementation of the CEnemyBullet class. // Download by http://www.NewXing.com ////////////////////////////////////////////////////////////////////// #include "EnemyBullet.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// BulletAttr CEnemyBullet::ePowTab[5] = { {1,15,15}, {1,15,15}, {1,15,15}, {1,15,20}, {1,20,20} }; CEnemyBullet::CEnemyBullet(CDirectWnd *win, CObList *ObList, int px, int py, int xspd, int yspd, int btype):CBullet(win,ObList) { id = 3; posx = px; posy = py; xspeed = xspd; yspeed = yspd; bulletType = btype; power = ePowTab[bulletType].power; width = ePowTab[bulletType].width; height = ePowTab[bulletType].height; } CEnemyBullet::~CEnemyBullet() { } void CEnemyBullet::LoadPic() { BulletPic = m_win->lpBKGObject[6]; } void CEnemyBullet::Action() { RECT rtSrc,rtDest; m_win->GetRect(&rtDest,posx,posy,width,height); m_win->GetRect(&rtSrc,15*bulletType,0,width,height); m_win->BltObject(BulletPic,&rtSrc,&rtDest); posx += xspeed; posy += yspeed; if( posx < 0 || posx > SrcWidth - width || posy < 0 || posy > SrcHeight - height) { setExist(0); } }