📄 sprite.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -