-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcafard.cpp
38 lines (31 loc) · 1.07 KB
/
cafard.cpp
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
#include "cafard.h"
namespace TOWERDEFENSE{
Cafard::Cafard(){}
Cafard::Cafard(const double taille,const int x, const int y, QGraphicsPixmapItem *parent):Insecte(taille,10*pow(taille,2),5*pow(taille,2),2,RAMPANT,parent)
{
for(int i = 0; i < 3; ++i)
{
QPixmap* animTemp = new QPixmap("data/cafard" + QString::number(i+1) + ".png");
*animTemp = animTemp->scaled(taille*32,taille*32);
animPixmap.push_back(animTemp);
}
animState = 0; // Première frame de l'animation à 0
// Image et taille
this->setPixmap(*animPixmap.first());
// Position
this->setPos(x,y);
this->setData(0,"CAFARD");
}
void Cafard::recevoirDegats(double degats){
Insecte::recevoirDegats(degats);
if(this->vitalite <= 0 && this->taille >= 2)
{
emit this->ajouterInsecteEnfant(1,this->taille-1,this->x(),this->y(),this->getPath(),this->getCounter(),1);
emit this->ajouterInsecteEnfant(1,this->taille-1,this->x(),this->y(),this->getPath(),this->getCounter(),2);
}
}
void Cafard::advance(int phase)
{
Insecte::advance(phase);
}
}