1 /**************************************************************************
2 Ghosts Overboard 'Meego 1.2 Harmattan'
4 Copyright (C) 2011 Heli Hyvättinen
6 This file is part of Ghosts Overboard
8 Ghosts Overboard is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **************************************************************************/
25 Octopus::Octopus(QPixmap pixmap, int speed, QGraphicsItem *parent) :
26 TimerControlledGraphicsPixmapObject(pixmap,speed,parent)
30 bool Octopus::handleCollisions()
33 QList<QGraphicsItem*> collidesList = collidingItems();
34 if (collidesList.isEmpty())
35 return true; //retain new position
39 //change direction if hit anything
41 //the game allows only one object to saty at given spot, so just check the firs one
42 if (collidesList.at(0)->data(0) == "ship")
44 emit droppingGhosts();
46 return false; //go back to old position