2
* Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License as
6
* published by the Free Software Foundation; either version 2 of
7
* the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "characteritem.h"
27
* @brief This class manage the display of the Kapman.
29
class KapmanItem : public CharacterItem {
35
/** Number of frames to animate the KapmanItem */
36
static const int NB_FRAMES;
38
/** Animation update interval */
39
static const int ANIM_LOW_SPEED;
40
static const int ANIM_MEDIUM_SPEED;
41
static const int ANIM_HIGH_SPEED;
43
/** Timer used to animate the KapmanItem */
44
QTimeLine * m_animationTimer;
46
/** Rotation flag set by theme */
52
* Creates a new KapmanItem instance.
53
* @param p_model the Kapman model
55
KapmanItem(Kapman* p_model);
58
* Deletes the KapmanItem instance.
65
* Rotates the image function of the Kapman direction.
67
void updateDirection();
70
* Manages the collisions with any Element.
72
void manageCollision();
75
* Updates the KapmanItem coordinates.
76
* @param p_x the new x-coordinate
77
* @param p_y the new y-coordinate
79
void update(qreal p_x, qreal p_y);
82
* Starts the KapmanItem animation.
87
* Pauses the KapmanItem animation.
92
* Resumes the KapmanItem animation.
97
* Stops the KapmanItem animation.
102
* Sets the given frame to the KapmanItem.
103
* @param p_frame the frame to set
105
void setFrame(const int p_frame);
108
* Implements the CharacterItem method.
110
void startBlinking();
113
* Implements the CharacterItem method.
118
* Set if the KapmanItem should be rotated (set by theme flag RotateKapman).
121
void setRotationFlag(bool rotate) { m_rotationFlag=rotate; }