-
Notifications
You must be signed in to change notification settings - Fork 1
/
powerupDiamonds.cpp
72 lines (62 loc) · 865 Bytes
/
powerupDiamonds.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "powerupDiamonds.h"
#include "powerup.h"
#include <iostream>
#include <QRect>
#include <QImage>
Diamond::Diamond() : Powerup()
{
x = rand() % 450;
y = rand() % 550;
image.load("Gem.png");
rect = image.rect();
resetState();
}
Diamond::~Diamond()
{
//std::cout << ("Diamond deleted\n");
}
void Diamond::appear()
{
x = (rand() % 450);
y = (rand() % 550);
rect.moveTo(x,y);
}
void Diamond::setAppeared(bool a)
{
appeared = a;
}
bool Diamond::hasAppeared()
{
return appeared;
}
void Diamond::setActive(bool a)
{
active = a;
}
bool Diamond::isActive()
{
return active;
}
void Diamond::resetState()
{
rect.moveTo(x,y);
active = false;
appeared = false;
count = 0;
}
void Diamond::setX(int X)
{
x = X;
}
void Diamond::setY(int Y)
{
y = Y;
}
QRect Diamond::getRect()
{
return rect;
}
QImage & Diamond::getImage()
{
return image;
}