• 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
energizer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3  * Copyright 2007-2008 GaĆ«l Courcelle <gael.courcelle@gmail.com>
4  * Copyright 2007-2008 Alexia Allanic <alexia_allanic@yahoo.fr>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "energizer.h"
21 #include "kapman.h"
22 
23 const int Energizer::POINTS = 50;
24 
25 Energizer::Energizer(qreal p_x, qreal p_y, Maze* p_maze, const QString& p_imageId) : Element(p_x, p_y, p_maze) {
26  Element::setImageId(p_imageId);
27  m_points = Energizer::POINTS;
28  m_type = Element::ENERGYZER;
29 }
30 
31 Energizer::~Energizer() {
32 }
33 
34 void Energizer::doActionOnCollision(Kapman* p_kapman) {
35  p_kapman->winPoints(this);
36  // Tell to the maze that an element was eaten
37  m_maze->decrementNbElem();
38 }
39 
Element::setImageId
void setImageId(const QString &p_imageId)
Sets the Element image.
Definition: element.cpp:62
Element::m_points
int m_points
Points won when the Element is eaten.
Definition: element.h:69
Kapman::winPoints
void winPoints(Element *p_element)
Manages the points won.
Definition: kapman.cpp:135
Element::m_type
Type m_type
The Element type.
Definition: element.h:48
Maze::decrementNbElem
void decrementNbElem()
Decrements the number of remaining Elements.
Definition: maze.cpp:69
Energizer::Energizer
Energizer(qreal p_x, qreal p_y, Maze *p_maze, const QString &p_imageId)
Creates a new Energizer instance.
Definition: energizer.cpp:25
kapman.h
QString
Energizer::~Energizer
~Energizer()
Deletes the Energizer instance.
Definition: energizer.cpp:31
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:30
energizer.h
Element::ENERGYZER
Definition: element.h:41
Element::m_maze
Maze * m_maze
The Maze the Element is on.
Definition: element.h:63
Energizer::POINTS
static const int POINTS
The value of an Energyzer.
Definition: energizer.h:36
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
Energizer::doActionOnCollision
void doActionOnCollision(Kapman *p_kapman)
Computes an action on a collision with the Kapman.
Definition: energizer.cpp:34
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