sprite.h
来自「vc++ 飞机游戏1,是一种好玩的游戏,初学程序设计,这是个好开始!」· C头文件 代码 · 共 29 行
H
29 行
#ifndef SPRITE_H
#define SPRITE_H
class Sprite
{
protected:
GameWorld *pGameWorld;
int ExplosionFrameCount, ExplosionFrameIndex;// 爆炸动画帧数// 爆炸动画当前帧
double x, y; // X坐标和Y坐标
void AdjustPosition();// 已左上角作为中心点调整位置
public:
int sx, sy, w, h; // 在素材位图中的位置
int cx, cy, cw, ch; // 碰撞检测用矩形
int Life, Atackness;
double dx, dy;// 速度
bool Used;// 标记是否应被丢弃
bool OutOfClient();// 判断是否超出窗口客户区
bool OutOfSight();// 判断是否在视线范围之外
int GetX(){ return (int)x; }
int GetY(){ return (int)y; }
void SetX(int x_value){ x=x_value; }
void SetY(int y_value){ y=y_value; }
Sprite(GameWorld *pgw, int x_value, int y_value);
virtual void Update();// 刷新, 刷新位置和输出画面
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?