📄 bullet.h
字号:
// Bullet.h: interface for the CBullet class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BULLET_H__B5E6C45D_3C68_4CF3_B36A_A062FCEC8ED5__INCLUDED_)
#define AFX_BULLET_H__B5E6C45D_3C68_4CF3_B36A_A062FCEC8ED5__INCLUDED_
#include "Tank_Defs.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
const int START=1;
const int MIDDLE=2;
const int END=3;
class CGame;
class CBullet
/****************************************************************
*基类 *
*归纳各种子弹的共性,并提供纯虚函数接口 *
****************************************************************/
{
public:
CBullet();
virtual ~CBullet();
public:
void DestroyObj(Obj &object);
Obj HasObject(int xpos,int ypos);
void SetBulletBmp(LPDIRECTDRAWSURFACE bmp);
void CBullet::DrawBullet(LPDIRECTDRAWSURFACE pdds);
void SetPosition(int n,int m);
int MapxyTonXnY();
Result IsWhat(int xt,int yt);//从地图里面判断前方是什么
BOOL ChangeColor(COLORREF x=0x00000000ff); //改变颜色
virtual BOOL BulletTrack()=0; //各种子弹的弹道
BOOL BulletAnimate(int state=START); //各种子弹得动画(三阶段:出发,飞行途中,击中)
void SetSpeed(int speed=4){m_nSpeed=speed;}
void SetDamage(int n=50){m_nDamage=n;}
int GetDamage()const{return m_nDamage;}
int GetSpeed(){return m_nSpeed;}
CRect rect;
void SetRect(){rect.SetRect(x,y,x+BULLETWIDTH,y+BULLETHEIGHT);}
inline void SetDirection(TankDirection direction){m_nDirection=direction;}
inline void SetGame(CGame * pGame){ m_pGame=pGame;}
inline int Getx(){return x;}
inline int Gety(){return y;}
inline void SetBelong(BYTE a){Belong=a;}
inline void Setx(int m){x=m;} //以下两种方法主要针对子弹双发而设置
inline void Sety(int n){y=n;}
protected:
LPDIRECTDRAWSURFACE m_bmpBullet;
CString strMsg;
CGame *m_pGame;
TankDirection m_nDirection;
int m_nSpeed; //用来记录子弹速度基数
int m_nX; //记录子弹的x位置--以中轴线为基准
int m_nY; //记录子弹的y位置
int x,y; //对应象素坐标
int m_nDamage; //记录子弹伤害力
int index; //标定是那一种子弹
BYTE Belong; //标定子弹的出处/* 3,NPC、1,left-play、2,right-play*/
};
#endif // !defined(AFX_BULLET_H__B5E6C45D_3C68_4CF3_B36A_A062FCEC8ED5__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -