📄 tplayersship.h
字号:
// Copyright 2002 Kenneth Guy,
//
// TPlayersShip.h
#ifndef _TPLAYERSSHIP_H_
#define _TPLAYERSSHIP_H_
/** \file TPlayersShip.h
defines class TPlayersShip */
#include "TSprite32x24.h"
/** Handles players ship.
Handles movement, it keeps the ship sprite within the visible area
of the the offscreen map. It also keeps track of the health of the
ship, changing the ship sprite to each of the explosion sprites
in turn when the health drops to zero.
*/
class TPlayersShip : public TSprite32x24 {
public:
TPlayersShip(TInt16 aX,TInt16 aY, TInt16 aHealth,
TInt16 aShipSprite, TInt16 aCrashingStartSprite,
TInt16 aCrashingEndSprite);
void AddHealth(TInt16 aHealth);
void SetHealth(TInt16 aHealth);
TInt16 Health();
TBool Dieing();
TBool Dead();
void MoveBy(TInt16 aX,TInt16 aY, TBool aAllowOfScreen);
private:
void UpdateSprite();
private:
TInt16 iHealth; /**< Players health, <=0 is dead */
TInt16 iCrashFrame; /**< which explosion sprite to plot while dieing */
TInt16 iShipSprite; /**< sprite of healthy ship */
TInt16 iCrashingStartSprite; /**< sprite thats starts explosion */
TInt16 iCrashingEndSprite; /**< last sprite of explosion animation */
TInt16 iLastX; /**< last position */
TInt16 iLastY; /**< last position */
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -