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

granatier

  • sources
  • kde-4.14
  • kdegames
  • granatier
  • src
bomb.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Mathias Kraus <k.hias@gmx.de>
3  * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
4  * Copyright 2007-2008 Pierre-BenoĆ®t Besse <besse.pb@gmail.com>
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 #ifndef BOMB_H
21 #define BOMB_H
22 
23 #include "element.h"
24 
25 class QTimer;
26 
30 class Bomb : public Element
31 {
32 
33  Q_OBJECT
34 
35 protected:
36 
38  qreal m_xSpeed;
39 
41  qreal m_ySpeed;
42 
44  qreal m_speed;
45 
47  bool m_detonated;
48 
50  int m_bombPower;
51 
53  int m_bombID;
54 
56  int m_explosionID;
57 
59  QTimer* m_detonationCountdownTimer;
60 
62  QTimer* m_mortarTimer;
63 
64  int m_mortarState;
65 
66  bool m_thrown;
67  bool m_stopOnCenter;
68 
69  bool m_falling;
70 
71 public:
72 
81  Bomb(qreal fX, qreal fY, Arena* p_arena, int nBombID, int nDetonationCountdown);
82 
86  ~Bomb();
87 
91  void goUp();
92 
96  void goDown();
97 
101  void goRight();
102 
106  void goLeft();
107 
111  void updateMove();
112 
117  void move(qreal x, qreal y);
118 
123  qreal getXSpeed() const;
124 
129  qreal getYSpeed() const;
130 
135  qreal getSpeed();
136 
141  void setXSpeed(qreal p_xSpeed);
142 
147  void setYSpeed(qreal p_ySpeed);
148 
153  void setThrown(int nDirection);
154 
159  void setKicked(int nDirection);
160 
165  int bombPower();
166 
171  void setBombPower(int bombPower);
172 
176  bool isDetonated();
177 
183  void initDetonation(int nBombID, int nDetonationTimeout);
184 
188  int explosionID();
189 
193  void pause();
194 
198  void resume();
199 
200 public slots:
204  void detonate();
205 
206  void slot_detonationCompleted();
207 
208  void updateMortarState();
209 
210 protected:
211 
216  bool onCenter();
217 
221  void moveOnCenter();
222 
223 signals:
228  void bombDetonated(Bomb* bomb);
229 
233  void releaseBombArmory();
234 
239  void mortar(int nMortarState, int nMortarRampEnd, int nMortarPeak, int nMortarGround);
240 
244  void falling();
245 };
246 
247 #endif
248 
Bomb::m_detonated
bool m_detonated
The Bomb detonation has already started.
Definition: bomb.h:47
Bomb::getXSpeed
qreal getXSpeed() const
Gets the Bomb x-speed value.
Definition: bomb.cpp:318
Bomb::falling
void falling()
Emitted when the bomb is falling in a hole.
element.h
Bomb::goUp
void goUp()
Makes the Bomb go up.
Definition: bomb.cpp:73
Bomb::mortar
void mortar(int nMortarState, int nMortarRampEnd, int nMortarPeak, int nMortarGround)
Emitted when the Bomb is thrown by the mortar or by the player.
nMortarGround
const int nMortarGround
Definition: bomb.cpp:29
Bomb::setBombPower
void setBombPower(int bombPower)
Sets the Power of the bomb.
Definition: bomb.cpp:450
Bomb::m_speed
qreal m_speed
The Bomb speed.
Definition: bomb.h:44
Bomb::detonate
void detonate()
Manages the Bomb explosion.
Definition: bomb.cpp:471
Bomb::m_mortarState
int m_mortarState
Definition: bomb.h:64
Bomb::getYSpeed
qreal getYSpeed() const
Gets the Bomb y-speed value.
Definition: bomb.cpp:323
Bomb::Bomb
Bomb(qreal fX, qreal fY, Arena *p_arena, int nBombID, int nDetonationCountdown)
Creates a new Bomb instance.
Definition: bomb.cpp:31
Bomb::m_stopOnCenter
bool m_stopOnCenter
Definition: bomb.h:67
Bomb::moveOnCenter
void moveOnCenter()
Moves the Bomb on the center of its current Cell.
Definition: bomb.cpp:439
nMortarRampEnd
const int nMortarRampEnd
Definition: bomb.cpp:27
Bomb::goDown
void goDown()
Makes the Bomb go down.
Definition: bomb.cpp:77
Bomb::setKicked
void setKicked(int nDirection)
The direction to move.
Definition: bomb.cpp:384
Bomb::m_explosionID
int m_explosionID
The ID of the Bomb that causes the explosion.
Definition: bomb.h:56
Bomb::initDetonation
void initDetonation(int nBombID, int nDetonationTimeout)
sets the explosion ID and detonation countdown
Definition: bomb.cpp:493
Bomb::m_bombID
int m_bombID
The Bomb ID.
Definition: bomb.h:53
Bomb::m_thrown
bool m_thrown
Definition: bomb.h:66
Bomb::getSpeed
qreal getSpeed()
Gets the Bomb speed.
Definition: bomb.cpp:328
Bomb::onCenter
bool onCenter()
Checks the Bomb gets on a Cell center during its next movement.
Definition: bomb.cpp:407
Bomb::m_falling
bool m_falling
Definition: bomb.h:69
Bomb::m_mortarTimer
QTimer * m_mortarTimer
Timer used for the throw bonus and mortar.
Definition: bomb.h:62
QTimer
Bomb::goRight
void goRight()
Makes the Bomb go to the right.
Definition: bomb.cpp:81
Bomb::m_detonationCountdownTimer
QTimer * m_detonationCountdownTimer
Timer used to make the bomb detonate.
Definition: bomb.h:59
Bomb::m_xSpeed
qreal m_xSpeed
The Bomb x-speed.
Definition: bomb.h:38
Bomb::bombDetonated
void bombDetonated(Bomb *bomb)
Emitted when the Bomb is exploded.
Bomb
This class describes the common characteristics and behaviour of the bomb item.
Definition: bomb.h:30
Bomb::updateMortarState
void updateMortarState()
Definition: bomb.cpp:522
nMortarPeak
const int nMortarPeak
Definition: bomb.cpp:28
Arena
This class represents the Arena of the game.
Definition: arena.h:36
Bomb::isDetonated
bool isDetonated()
Definition: bomb.cpp:483
Bomb::setThrown
void setThrown(int nDirection)
The direction to throw.
Definition: bomb.cpp:343
Bomb::m_bombPower
int m_bombPower
The Bomb detonation power.
Definition: bomb.h:50
Element
This class describes the common characteristics and behaviour of any game Element (character or item)...
Definition: element.h:32
Bomb::explosionID
int explosionID()
Definition: bomb.cpp:488
Bomb::releaseBombArmory
void releaseBombArmory()
Emitted to refill the player bomb armory.
Bomb::bombPower
int bombPower()
Power of the bomb.
Definition: bomb.cpp:445
Bomb::m_ySpeed
qreal m_ySpeed
The Bomb y-speed.
Definition: bomb.h:41
Bomb::pause
void pause()
Pauses bomb timer.
Definition: bomb.cpp:455
Bomb::resume
void resume()
Resumes bomb timer.
Definition: bomb.cpp:463
Bomb::updateMove
void updateMove()
Updates the Bomb move.
Definition: bomb.cpp:89
Bomb::~Bomb
~Bomb()
Deletes the Bomb instance.
Definition: bomb.cpp:67
Bomb::setXSpeed
void setXSpeed(qreal p_xSpeed)
Set the Bomb x-speed value.
Definition: bomb.cpp:333
Bomb::move
void move(qreal x, qreal y)
Moves the Bomb function of its current coordinates and speed.
Definition: bomb.cpp:310
Bomb::slot_detonationCompleted
void slot_detonationCompleted()
Definition: bomb.cpp:516
Bomb::goLeft
void goLeft()
Makes the Bomb go to the left.
Definition: bomb.cpp:85
Bomb::setYSpeed
void setYSpeed(qreal p_ySpeed)
Set the Bomb y-speed value.
Definition: bomb.cpp:338
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

granatier

Skip menu "granatier"
  • Main Page
  • Namespace List
  • Namespace Members
  • 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