📄 ghost.h
字号:
/*
* ==============================================================================
* Name : Ghost.h
* Part of : RGA Game Example
* Interface :
* Description : ghost sprites
* Version : 1.0
*
* Copyright (c) 2007-2008 Nokia Corporation.
* This material, including documentation and any related
* computer programs, is protected by copyright controlled by
* Nokia Corporation.
* ==============================================================================
*/
#ifndef __GHOST_H__
#define __GHOST_H__
#include "RotatingSprite.h"
#include "Level.h"
class CGhost : public CRotatingSprite
{
public:
CGhost(CApplicationBase& aApp, CLevel& aLevel);
virtual ~CGhost();
/**
* Init
* initialise ghost with given images
* @param aBitmap sprite image
* @param aMask sprite alpha mask, or NULL
* @return KErrNone if successfull
*/
TInt Init( IBitmap* aBitmap,
IBitmap* aMask);
/**
* Update
* updates ghost object, run AI
* @param aFrametime frame time multiplier
*/
virtual void Update(const TReal64 aFrametime);
/**
* Draw
* draw ghost to its current location
* sprite is drawn rotated based on current angle
* @param aContext context to draw sprite into
* @param aCamera camera coordinate to subtract from sprite coordinates
*/
virtual void Draw(IGraphicsContext& aContext, const TVector2& aCamera);
/**
* SetAIParams
* set parameters related to ghost AI
* @param aPlayer player to chase
* @param aStartPos starting position of the ghost
* @param aEndPos 'move-to' position of the ghost
* @param aExtraParam ghost specific value
* @param aType type of the ghost (bitmapindex)
*/
void SetAIParams( CSpriteBase* aPlayer,
const TPoint& aStartPos,
const TPoint& aEndPos,
const TInt aExtraParam,
const TInt aType);
private:
/**
* UpdateAIRed
* update red ghost AI (chase player)
* @param aFrametime application frame time
*/
void UpdateAIRed(const TReal64 aFrametime);
/**
* UpdateAIGreen
* update green ghost AI (patrol points)
* @param aFrametime application frame time
*/
void UpdateAIGreen(const TReal64 aFrametime);
/**
* UpdateAIBlue
* update blue ghost AI (gravity ghost)
* @param aFrametime application frame time
*/
void UpdateAIBlue(const TReal64 aFrametime);
private: // data
CLevel& iLevel;
// AI parameters
CSpriteBase* iPlayer;
TPoint iStartPos;
TPoint iEndPos;
TReal64 iSpeed;
TReal64 iPullForce;
TBool iMovingToEndPos;
};
#endif /* __GHOST_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -