1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
* Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "element.h"
Element::Element(qreal p_x, qreal p_y, Maze* p_maze) : m_xInit(p_x), m_yInit(p_y), m_maze(p_maze) {
m_points = 0;
initCoordinate();
}
Element::~Element() {
}
void Element::doActionOnCollision(Kapman*) {
// Do nothing by default : will be redefined within the subclasses
}
qreal Element::getX() const {
return m_x;
}
qreal Element::getY() const {
return m_y;
}
void Element::setX(qreal p_x) {
m_x = p_x;
emit(moved(m_x, m_y));
}
void Element::setY(qreal p_y) {
m_y = p_y;
emit(moved(m_x, m_y));
}
int Element::getPoints() const {
return m_points;
}
Element::Type Element::getType() const {
return m_type;
}
QString Element::getImageId() const {
return m_imageId;
}
void Element::setImageId(const QString & p_imageId){
m_imageId = p_imageId;
}
void Element::initCoordinate(){
setX(m_xInit);
setY(m_yInit);
}
|