summaryrefslogtreecommitdiffstats
path: root/pacman-c++/gameentity.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
committermanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
commitce48af53646cd9e7ec762fc1ac176b3aa620b11d (patch)
treef8fbf2cae8c7d0cbac2696a8f4cf94410bfb4928 /pacman-c++/gameentity.h
parente54ccad07e256ba877bd41d70bd358bd0085bd1e (diff)
downloadfoop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.gz
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.bz2
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.zip
- refactorized the whole project and made a few subprojects
- replaced tcp with enet - added connect dialog - some smaller bugfixes
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