• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kapman

  • sources
  • kde-4.14
  • kdegames
  • kapman
ghost.h
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3  * Copyright 2007-2008 Alexandre Galinier <alex.galinier@hotmail.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef GHOST_H
20 #define GHOST_H
21 
22 #include "character.h"
23 #include "kapman.h"
24 
25 
29 class Ghost : public Character {
30 
31  Q_OBJECT
32 
33  public:
34 
36  enum State {
37  HUNTER = 0,
38  PREY = 1,
39  EATEN = 2
40  };
41 
43  static const int POINTS;
44 
45 
46  private:
47 
49  static const qreal MAX_SPEED_RATIO;
50 
52  QString m_imageId;
53 
55  State m_state;
56 
58  QList<QPoint> m_pathToCamp;
59 
60  public:
61 
69  Ghost(qreal p_x, qreal p_y, const QString & p_imageId, Maze* p_maze);
70 
74  ~Ghost();
75 
79  void updateMove();
80 
86  void updateMove(int p_row, int p_col);
87 
92  QString getImageId() const;
93 
98  State getState() const;
99 
104  void setState(Ghost::State p_state);
105 
110  void doActionOnCollision(Kapman* p_kapman);
111 
115  void initSpeedInc();
116 
117  private:
118 
122  void goUp();
123 
127  void goDown();
128 
132  void goRight();
133 
137  void goLeft();
138 
139  signals:
140 
144  void lifeLost();
145 
150  void ghostEaten(Ghost* p_ghost);
151 
155  void stateChanged();
156 };
157 
158 #endif
159 
character.h
Ghost::lifeLost
void lifeLost()
Emitted when the Kapman has lost a life.
Ghost::EATEN
Definition: ghost.h:39
Ghost::updateMove
void updateMove()
Updates the Ghost move.
Definition: ghost.cpp:66
Ghost::POINTS
static const int POINTS
The value of an Ghost.
Definition: ghost.h:43
Character
This class describes the common characteristics and behaviour of the game characters (Kapman and the ...
Definition: character.h:27
Ghost::PREY
Definition: ghost.h:38
Ghost::getImageId
QString getImageId() const
Gets the path to the Ghost image.
Definition: ghost.cpp:187
Ghost
This class represents a Ghost for kapman.
Definition: ghost.h:29
Ghost::setState
void setState(Ghost::State p_state)
Sets the Ghost state to the given value.
Definition: ghost.cpp:195
Ghost::Ghost
Ghost(qreal p_x, qreal p_y, const QString &p_imageId, Maze *p_maze)
Creates a new Ghost instance.
Definition: ghost.cpp:29
Ghost::HUNTER
Definition: ghost.h:37
kapman.h
Ghost::stateChanged
void stateChanged()
Emitted when the Ghost has changed his state.
Ghost::ghostEaten
void ghostEaten(Ghost *p_ghost)
Emitted when the Ghost has been eaten.
QString
QList< QPoint >
Ghost::State
State
The ghost possible states.
Definition: ghost.h:36
Ghost::initSpeedInc
void initSpeedInc()
Initializes the Ghost speed from the Character speed.
Definition: ghost.cpp:224
Ghost::getState
State getState() const
Gets the current state of the Ghost.
Definition: ghost.cpp:191
Ghost::~Ghost
~Ghost()
Deletes the Ghost instance.
Definition: ghost.cpp:42
Ghost::doActionOnCollision
void doActionOnCollision(Kapman *p_kapman)
Manages the collison with the Kapman.
Definition: ghost.cpp:210
Kapman
This class represents the main character of the game.
Definition: kapman.h:26
Maze
This class represents the Maze of the game.
Definition: maze.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kapman

Skip menu "kapman"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal