-
Notifications
You must be signed in to change notification settings - Fork 1
/
terminatorrobot.cpp
59 lines (54 loc) · 1.75 KB
/
terminatorrobot.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
#include "terminatorrobot.h"
CTerminatorRobot::CTerminatorRobot()
{
hp = 210;
multiTarget = true;
power = 30;
pr.gold = 40;
pr.platinum = 20;
pr.rhodium = 3;
model = Terminator;
}
CTerminatorRobot::~CTerminatorRobot()
{
}
QPixmap CTerminatorRobot::draw(int color, int dir)
{
QMap<int, QPixmap> robot;
QMap<int, QPixmap> light;
QMap<int, QPixmap> gun;
QPixmap shadow;
QPixmap zirs;
zirs = QPixmap("./images/pa.png");
robot[Yellow] = QPixmap("./images/bot3/bot3yellow");
robot[Red] = QPixmap("./images/bot3/bot3red");
robot[Cyan] = QPixmap("./images/bot3/bot3blue");
robot[Magenta] = QPixmap("./images/bot3/bot3pink");
light[Red] = QPixmap("./images/bot3/red3");
light[Cyan] = QPixmap("./images/bot3/blue3");
light[Yellow] = QPixmap("./images/bot3/yellow3");
light[Magenta] = QPixmap("./images/bot3/pink3");
gun[Cyan] = zirs.copy(36,0,60,116);
gun[Magenta] = zirs.copy(36,0,60,116);
gun[Red] = zirs.copy(36,0,60,116);
gun[Yellow] = zirs.copy(36,0,60,116);
shadow = QPixmap("./images/bot3/shadow3");
QPixmap output(360,360);
output.fill(Qt::transparent);
QPainter painter(&output);
painter.setRenderHint(QPainter::Antialiasing);
painter.drawPixmap(0,0,light[color]);
painter.drawPixmap(0,0,robot[color]);
painter.drawPixmap(129,90,gun[color]);
QTransform t(1, 0, 0, 1, output.width()/2, output.height()/2);
t.rotate(dir*(360/6));
QPixmap tempOutput = output.copy(0,0,light[color].width(),light[color].height()).transformed(t);
output.fill(Qt::transparent);
painter.drawPixmap(50,20,shadow.transformed(t));
painter.drawPixmap(0,0,tempOutput);
return output.scaled(300,300);
}
int CTerminatorRobot::hit()
{
return power;
}