summaryrefslogtreecommitdiffstats
path: root/pacman-c++/gameentity.h
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/gameentity.h')
-rw-r--r--pacman-c++/gameentity.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/pacman-c++/gameentity.h b/pacman-c++/gameentity.h
index 92b485e..116fae5 100644
--- a/pacman-c++/gameentity.h
+++ b/pacman-c++/gameentity.h
@@ -20,6 +20,13 @@ public:
20 Type = UserType + 1 20 Type = UserType + 1
21 }; 21 };
22 22
23 enum EnteredState
24 {
25 Nothing,
26 DestroyedEntity,
27 DestroyedActor
28 };
29
23public: 30public:
24 GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0); 31 GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0);
25 GameEntity(QGraphicsItem *parent); 32 GameEntity(QGraphicsItem *parent);
@@ -41,18 +48,10 @@ public:
41 /* performs action when this actor acctually enters 48 /* performs action when this actor acctually enters
42 * returns whether this entity survives the entering 49 * returns whether this entity survives the entering
43 */ 50 */
44 virtual bool enter(Actor *) 51 virtual EnteredState enter(Actor *)
45 { 52 {
46 /* default to no action/survive */ 53 /* default to no action/survive */
47 return true; 54 return Nothing;
48 }
49
50 /* check whether this entity is regarded as eaten
51 * (and can be removed in the next tick)
52 */
53 virtual bool eaten()
54 {
55 return m_eaten;
56 } 55 }
57 56
58 /* called when an instance acctually dies for creating effects */ 57 /* called when an instance acctually dies for creating effects */
@@ -67,7 +66,6 @@ public:
67 66
68protected: 67protected:
69 int m_type; 68 int m_type;
70 bool m_eaten;
71 Color::Color m_color; 69 Color::Color m_color;
72}; 70};
73 71