📄 enemybullet.cpp
字号:
// EnemyBullet.cpp: implementation of the CEnemyBullet class.
//
//////////////////////////////////////////////////////////////////////
#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);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -