ghost.h

来自「VIGASOCO (VIdeo GAmes SOurce COde) Windo」· C头文件 代码 · 共 74 行

H
74
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?