1/*
2 * Copyright 2007-2008 Thomas Gallinari <tg8187@yahoo.fr>
3 *
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.
8 *
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.
13 *
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/>.
16 */
17
18#include "element.h"
19
20Element::Element(qreal p_x, qreal p_y, Maze* p_maze) : m_xInit(p_x), m_yInit(p_y), m_maze(p_maze) {
21 m_points = 0;
22 initCoordinate();
23}
24
25Element::~Element() {
26}
27
28void Element::doActionOnCollision(Kapman*) {
29 // Do nothing by default : will be redefined within the subclasses
30}
31
32qreal Element::getX() const {
33 return m_x;
34}
35
36qreal Element::getY() const {
37 return m_y;
38}
39
40void Element::setX(qreal p_x) {
41 m_x = p_x;
42 emit(moved(m_x, m_y));
43}
44
45void Element::setY(qreal p_y) {
46 m_y = p_y;
47 emit(moved(m_x, m_y));
48}
49
50int Element::getPoints() const {
51 return m_points;
52}
53
54Element::Type Element::getType() const {
55 return m_type;
56}
57
58QString Element::getImageId() const {
59 return m_imageId;
60}
61
62void Element::setImageId(const QString & p_imageId){
63 m_imageId = p_imageId;
64}
65
66void Element::initCoordinate(){
67 setX(m_xInit);
68 setY(m_yInit);
69}
70