From 651a1bee1adc5318922d1b37b0cea11a65df71e2 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 12 Apr 2011 18:08:02 +0200 Subject: make removal of items from scene delayed by one tick (looks better) all items are now derived from gameentity and gameentity is derived from pixmapitem: - this is naturally better - allows us to add a generic gameentity.color() --- pacman-c++/gameentity.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'pacman-c++/gameentity.h') diff --git a/pacman-c++/gameentity.h b/pacman-c++/gameentity.h index afa3aba..2fde095 100644 --- a/pacman-c++/gameentity.h +++ b/pacman-c++/gameentity.h @@ -1,6 +1,8 @@ #ifndef GAMEENTITY_H #define GAMEENTITY_H +#include "constants.h" +#include "pixmapitem.h" #include class Actor; @@ -9,12 +11,20 @@ class Actor; * Base class for entities that interact in the game */ class GameEntity + : public PixmapItem { public: - GameEntity(); + GameEntity(Color::Color color = Color::none, QGraphicsItem *parent = 0); + GameEntity(QGraphicsItem *parent); virtual ~GameEntity() {}; + /* color of entity */ + virtual Color::Color color() + { + return m_color; + } + /* returns whether the actor may enter this field */ virtual bool checkEnter(Actor *) { @@ -42,9 +52,9 @@ public: virtual void onDie(Actor *) {}; - protected: bool m_eaten; + Color::Color m_color; }; #endif // GAMEENTITY_H -- cgit v1.2.3