⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monster.h

📁 吃豆子游戏源码
💻 H
字号:
/**
 *	File	:	Monster.h
 *  Author	:	Kevin Lynx
 *	Date	:	2007/7/31
 */
#ifndef	_MONSTER_H_
#define	_MONSTER_H_

#include "Sprite.h"

/**
 * the probability for creating bullets (monsters)
 *
 */
const float MF_MONSTER2 = 0.7f;
const float MF_MONSTER3 = 0.8f;
const float MF_MONSTER4 = 0.99f; 

/**
 * Monster class
 *
 * Implements the monsters in the game
 */
class	Monster : public Sprite, public SpriteStatus
{
public:
	/**
	 * Monster's common properties
	 *
	 */
	enum E_MonsterHP
	{
		MONSTER_2_HP = 10,
		MONSTER_3_HP = 20,
		MONSTER_4_HP = 30,
		MONSTER_MAX_HP = 40
	};
	enum E_MonsterScore
	{
		MONSTER_2_SCORE = 50,
		MONSTER_3_SCORE = 100,
		MONSTER_4_SCORE = 150
	};
public:
	/**
	 * Constructor
	 *
	 */
	Monster( int monsterType );

	/**
	 * Destructor
	 *
	 */
	~Monster();

	/**
	 * init , create meshes etc...
	 *
	 */
	bool	init( ISceneManager *smgr, IAnimatedMesh *mesh, ITexture *texture );
	void	update( float dt );
	
	/**
	 * hurt
	 *
	 * the monster was hurt by the pacman
	 * @param damage the monster hp will sub damage
	 */
	void	hurt( int damage );

	/**
	 * isNormalStatus
	 *
	 * if the monster is normal, it can be killed by the player
	 */
	bool	isNormalStatus();

	/// ai functions
	//AI for our monsters, ha`you know ,the monster can do something that i didnot 
	//plan. This behavior is pretty like humans, human always do exceptional things
	//that their god never thought.:D
	void	ai1(); 
	void	ai2();

private:
	/**
	 * searchNewHDir
	 *
	 */
	bool	searchNewHDir( int ax, int az, int &outXDir );
	bool	searchNewVDir( int ax, int az, int &outZDir );

	bool	canFire();

	void	initDirection();

	int		getInitHP( int type );
	int		getInitScore( int type );
private:
	/// one bullet can decress the hp 10
	int		mHP;
	/// ai data for monster2
	vector2di	mLastArrayPos;
public:
	int		mAddScore;

};

#endif //end _MONSTER_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -