kapman
game.cpp
Go to the documentation of this file.
233 m_bonus = new Bonus(qreal(Cell::SIZE * p_position.x()),qreal(Cell::SIZE * p_position.y()), m_maze, 100);
237 m_kapman = new Kapman(qreal(Cell::SIZE * p_position.x()),qreal(Cell::SIZE * p_position.y()), m_maze);
241 m_ghosts.append(new Ghost(qreal(Cell::SIZE * p_position.x()),qreal(Cell::SIZE * p_position.y()), p_imageId, m_maze));
258 // At the beginning, the timer is stopped but the Game isn't paused (to allow keyPressedEvent detection)
295 if ((p_event->key() == Qt::Key_Up || p_event->key() == Qt::Key_Down || p_event->key() == Qt::Key_Left || p_event->key() == Qt::Key_Right) && !m_timer->isActive()) {
410 // If the eaten element is a ghost, win 200 * number of eaten ghosts since the energizer was eaten
474 if (m_maze->getNbElem() == m_maze->getTotalNbElem() / 3 || m_maze->getNbElem() == (m_maze->getTotalNbElem() * 2 / 3)) {
void initCoordinate()
Initializes Element x-coordinate and y-coordinate with initial values.
Definition: element.cpp:66
void setInterval(int msec)
void init(const int p_nbRows, const int p_nbColumns)
Creates the Maze matrix.
Definition: maze.cpp:36
Qt::KeyboardModifiers modifiers() const
Cell getCell(const int p_row, const int p_column) const
Gets the Cell at the given coordinates.
Definition: maze.cpp:180
Definition: ghost.h:39
Definition: element.h:40
Definition: element.h:39
Definition: ghost.h:38
int size() const
void initMaze(const int p_nbRows, const int p_nbColumns)
Initializes a Maze.
Definition: game.cpp:244
void resetNbElem()
Resets the number of remaining Elements to the initial number.
Definition: maze.cpp:76
void levelStarted(const bool p_newLevel)
Emitted when a level begins, if level up or if a life has been lost.
void setState(Ghost::State p_state)
Sets the Ghost state to the given value.
Definition: ghost.cpp:195
qreal x() const
qreal y() const
void append(const T &value)
void pauseChanged(const bool p_pause, const bool p_fromUser)
Emitted when the pause state has changed.
Definition: ghost.h:37
static int s_bonusDuration
Timer duration for bonus apparition in medium difficulty.
Definition: game.h:47
void increaseCharactersSpeed()
Increases the Character speed with each level completed.
Definition: character.cpp:100
void createGhost(QPointF p_position, const QString &p_imageId)
Create the new Ghost.
Definition: game.cpp:240
void initSpeed()
Initializes the Character speed considering the difficulty level.
Definition: character.cpp:83
int key() const
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
static int s_preyStateDuration
Timer duration for prey state in medium difficulty.
Definition: game.h:44
void initSpeedInc()
Initializes the Kapman speed from the Character speed.
Definition: kapman.cpp:184
static qreal s_durationRatio
Ratio which modify the timers function of the difficulty.
Definition: game.h:41
void stop()
void pointsToDisplay(long p_wonPoints, qreal p_xPos, qreal p_yPos)
Emitted when a ghost or a bonus is eaten.
This class handles XML reader events in order to initialize the Maze properties.
Definition: kapmanparser.h:29
Definition: element.h:41
virtual bool parse(const QXmlInputSource &input)
void elementEaten(const qreal p_x, const qreal p_y)
Emitted when an Element has been eaten.
void start(int msec)
int getTotalNbElem() const
Gets the number of Elements initially on the Maze.
Definition: maze.cpp:219
int getNbElem() const
Gets the number of remaining Elements still on the Maze.
Definition: maze.cpp:215
int getRowFromY(const qreal p_y) const
Gets the row index corresponding to the given y-coordinate.
Definition: maze.cpp:199
bool isActive() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int getColFromX(const qreal p_x) const
Gets the column index corresponding to the given x-coordinate.
Definition: maze.cpp:203
void emitGameUpdated()
Emits a signal to Kapmanitem in order to manage collisions.
Definition: kapman.cpp:144
Definition: element.h:42
virtual void setContentHandler(QXmlContentHandler *handler)
void setSingleShot(bool singleShot)
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
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.