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.h72
1 files changed, 0 insertions, 72 deletions
diff --git a/pacman-c++/gameentity.h b/pacman-c++/gameentity.h
deleted file mode 100644
index 116fae5..0000000
--- a/pacman-c++/gameentity.h
+++ /dev/null
@@ -1,72 +0,0 @@
1#ifndef GAMEENTITY_H
2#define GAMEENTITY_H
3
4#include "constants.h"
5#include "pixmapitem.h"
6#include <QtGlobal>
7#include <QDebug>
8
9class Actor;
10
11/**
12 * Base class for entities that interact in the game
13 */
14class GameEntity
15 : public PixmapItem
16{
17public:
18 enum
19 {
20 Type = UserType + 1
21 };
22
23 enum EnteredState
24 {
25 Nothing,
26 DestroyedEntity,
27 DestroyedActor
28 };
29
30public:
31 GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0);
32 GameEntity(QGraphicsItem *parent);
33 virtual ~GameEntity()
34 {};
35
36 /* color of entity */
37 virtual Color::Color color()
38 {
39 return m_color;
40 }
41
42 /* returns whether the actor may enter this field */
43 virtual bool checkEnter(Actor *)
44 {
45 return true;
46 }
47
48 /* performs action when this actor acctually enters
49 * returns whether this entity survives the entering
50 */
51 virtual EnteredState enter(Actor *)
52 {
53 /* default to no action/survive */
54 return Nothing;
55 }
56
57 /* called when an instance acctually dies for creating effects */
58 virtual void onDie(Actor *)
59 {};
60
61 /* enable the use of qgraphicsitem_cast with this item */
62 int type() const
63 {
64 return m_type;
65 }
66
67protected:
68 int m_type;
69 Color::Color m_color;
70};
71
72#endif // GAMEENTITY_H