📄 ghost.h
字号:
// Ghost.h
//
// Base class with common data and behaviour for the ghosts
//
/////////////////////////////////////////////////////////////////////////////
#ifndef _GHOST_H_
#define _GHOST_H_
#include "Character.h"
class GhostAction; // defined in GhostAction.h
enum GhostIDs {
RED = 0,
PINK = 1,
BLUE = 2,
ORANGE = 3
};
class Ghost : public Character
{
// fields
public:
GhostIDs id;
// position and orientation
Orientation prevOrientation;
int actualTilePosX, actualTilePosY; // changed after a move
int prevMovOffsX, prevMovOffsY;
int destTilePosX, destTilePosY;
// movement patterns
UINT32 movNormalPattern;
UINT32 movPanicPattern;
UINT32 movTunnelPattern;
// ghost state
int state;
int substate;
bool panicMode;
GhostAction **moveAtHomeAction;
GhostAction **moveWhenKilledAction;
// methods
protected:
void moveMiddle();
void moveNoMiddle();
public:
virtual void run();
void move();
void moveAtHome();
void moveWhenKilled();
void moveInPanicState();
virtual void moveInNormalState() = 0;
void changeOrientation();
void checkOrientationChanges();
virtual void selectProperAnimation();
virtual void draw();
// initialization and cleanup
Ghost(GhostIDs ghostId);
virtual ~Ghost();
virtual void resetState();
virtual void initState(bool special);
};
#endif // _GHOST_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -