diff options
| author | totycro <totycro@unknown-horizons.org> | 2011-04-11 12:37:29 +0200 |
|---|---|---|
| committer | totycro <totycro@unknown-horizons.org> | 2011-04-11 12:37:29 +0200 |
| commit | 51a3559e5df31018d7de14357f83c24e7e508d7e (patch) | |
| tree | 89db0899d182dd5b3b770b07c8646dd80c915d4e /pacman-c++/gameentity.h | |
| parent | 98f4a31e1a359a69dbcc0fa4055f36cefb6d4e02 (diff) | |
| download | foop-51a3559e5df31018d7de14357f83c24e7e508d7e.tar.gz foop-51a3559e5df31018d7de14357f83c24e7e508d7e.tar.bz2 foop-51a3559e5df31018d7de14357f83c24e7e508d7e.zip | |
progress
Diffstat (limited to 'pacman-c++/gameentity.h')
| -rw-r--r-- | pacman-c++/gameentity.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pacman-c++/gameentity.h b/pacman-c++/gameentity.h index 82df438..2a771ee 100644 --- a/pacman-c++/gameentity.h +++ b/pacman-c++/gameentity.h | |||
| @@ -1,19 +1,29 @@ | |||
| 1 | #ifndef GAMEENTITY_H | 1 | #ifndef GAMEENTITY_H |
| 2 | #define GAMEENTITY_H | 2 | #define GAMEENTITY_H |
| 3 | 3 | ||
| 4 | #include <QtGlobal> | ||
| 5 | |||
| 4 | class Actor; | 6 | class Actor; |
| 5 | 7 | ||
| 6 | /** | 8 | /** |
| 7 | * Abstract base class for entities that interact in the game | 9 | * Base class for entities that interact in the game |
| 8 | */ | 10 | */ |
| 9 | class GameEntity { | 11 | class GameEntity { |
| 12 | public: | ||
| 13 | GameEntity(); | ||
| 14 | virtual ~GameEntity() {}; | ||
| 10 | 15 | ||
| 11 | // returns whether the actor may enter this field | 16 | // returns whether the actor may enter this field |
| 12 | virtual bool checkEnter(Actor *actor) = 0; | 17 | virtual bool checkEnter(Actor *actor) { Q_UNUSED(actor); return true; } // default to true |
| 13 | 18 | ||
| 14 | // performs action when this actor acctually enters | 19 | // performs action when this actor acctually enters |
| 15 | virtual void enter(Actor *actor) = 0; | 20 | // returns whether this entity survives the entering |
| 21 | virtual bool enter(Actor *actor) { Q_UNUSED(actor); return true; } // default to no action/survive | ||
| 22 | |||
| 23 | virtual bool eaten() { return m_eaten; } | ||
| 16 | 24 | ||
| 25 | protected: | ||
| 26 | bool m_eaten; | ||
| 17 | }; | 27 | }; |
| 18 | 28 | ||
| 19 | #endif // GAMEENTITY_H | 29 | #endif // GAMEENTITY_H |
