-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddballbrick.cpp
52 lines (48 loc) · 952 Bytes
/
addballbrick.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "addballbrick.h"
#include<QGraphicsScene>
AddBallBrick::AddBallBrick(QGraphicsItem* parent):
AbstractSurprisingBrick(1,QColor(0,74,128,200),parent)
{
}
AddBallBrick::~AddBallBrick()
{
this->setAward();
}
void AddBallBrick::setAward()
{
Gift *gift;
switch(qrand()%20+1)
{
case 1:
case 2:
gift=new Gift(Gift::addOneNormalBall);
break;
case 3:
case 4:
gift=new Gift(Gift::addThreeNormalBall);
break;
case 5:
case 6:
case 7:
case 8:
gift=new Gift(Gift::addOneFastBall);
break;
case 9:
case 10:
gift=new Gift(Gift::addOneSlowBall);
break;
case 11:
case 12:
gift=new Gift(Gift::addOneSuperBall);
break;
case 13:
gift=new Gift(Gift::addOneSmallBall);
break;
default:
gift=new Gift(Gift::addTwoNormalBall);
break;
}
this->scene()->addItem(gift);
gift->setPos(this->pos());
emit this->awardSent(gift);
}