Separated actual collision detection into subclass Ship
[ghostsoverboard] / ship.cpp
1 #include "ship.h"
2 #include <QDebug>
3
4 Ship::Ship(QPixmap pixmap, QGraphicsItem *parent) :
5     OrientationControlledGraphicsPixmapObject(pixmap,parent)
6 {
7
8 }
9
10 bool Ship::handleCollisions()
11 {
12     QList<QGraphicsItem*>  collidesList = collidingItems();
13
14     if (collidesList.isEmpty())
15         return true;
16
17     else
18     {
19         QString type = collidesList.at(0)->data(0).toString();
20         qDebug() << type;
21         if (type == "rock" || type == "octopus")
22         {
23 //            dropGhosts();
24             return false;
25         }
26
27         else if (type == "ghost")
28         {
29             return true;
30         }
31
32     }
33 }