summaryrefslogtreecommitdiffstats
path: root/pacman-c++/gameentity.h
blob: 2a771eeced061cea9fa91291f0f049a4076a0af5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef GAMEENTITY_H
#define GAMEENTITY_H

#include <QtGlobal>

class Actor;

/**
 * Base class for entities that interact in the game
 */
class GameEntity {
public:
  GameEntity();
  virtual ~GameEntity() {};

  // returns whether the actor may enter this field
  virtual bool checkEnter(Actor *actor) { Q_UNUSED(actor); return true; } // default to true

  // performs action when this actor acctually enters
  // returns whether this entity survives the entering
  virtual bool enter(Actor *actor) { Q_UNUSED(actor); return true; } // default to no action/survive

  virtual bool eaten() { return m_eaten; }

protected:
  bool m_eaten;
};

#endif // GAMEENTITY_H