-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplosion.cpp
More file actions
31 lines (28 loc) · 910 Bytes
/
explosion.cpp
File metadata and controls
31 lines (28 loc) · 910 Bytes
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
#include "explosion.h"
Explosion::Explosion(int height, int width, QGraphicsItem *parent):QObject (), QGraphicsPixmapItem (parent)
{
this->timer = new QTimer;
this->i=1;
this->height=height;
this->width=width;
connect(timer,SIGNAL(timeout()),this, SLOT(show()));
timer->start(15);
}
void Explosion::show()
{
QString PixmapDirectory;
if(i<10){
PixmapDirectory=
QString(":/graphic/explosion/SpaceInvader/explosion_1/image_part_00")+QString::number(i)+QString(".png");
}
else if(i>=10 && i<=48){
PixmapDirectory=
QString(":/graphic/explosion/SpaceInvader/explosion_1/image_part_0")+QString::number(i)+QString(".png");
}
else {
this->timer->stop();
return;
}
setPixmap(QPixmap(PixmapDirectory).scaled(width,height));
this->i++;
}