-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerStat.cpp
More file actions
103 lines (85 loc) · 1.63 KB
/
Copy pathPlayerStat.cpp
File metadata and controls
103 lines (85 loc) · 1.63 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "PlayerStat.h"
PlayerStat::PlayerStat()
{
number_=0;
}
PlayerStat::~PlayerStat()
{
}
void PlayerStat::AddPos(const int& xPos)
{
pos_list.push_back(xPos);
}
void PlayerStat::Init(SDL_Renderer* screen)
{
LoadImage("Images//player_life.png",screen);
number_=3;
if(pos_list.size()>0) pos_list.clear();
AddPos(20);
AddPos(60);
AddPos(100);
}
void PlayerStat::Show(SDL_Renderer* screen)
{
for(int i=0; i<pos_list.size(); i++)
{
rect_.x=pos_list.at(i);
rect_.y=0;
Render(screen);
}
}
void PlayerStat::Decrease()
{
number_--;
pos_list.pop_back();
}
void PlayerStat::Increase()
{
number_++;
int last_pos= pos_list.back();
last_pos+=40;
pos_list.push_back(last_pos);
}
PlayerPower::PlayerPower()
{
x_pos=0;
y_pos=0;
}
PlayerPower::~PlayerPower()
{
}
void PlayerPower::Init(SDL_Renderer* screen, int type)
{
bool ret;
if(type==1) ret=LoadImage("Images//player_health.png",screen);
else ret=LoadImage("Images//player_mana.png",screen);
}
void PlayerPower::Show(SDL_Renderer* screen)
{
rect_.x=x_pos;
rect_.y=y_pos;
Render(screen);
}
Buff::Buff()
{
x_pos=0;
y_pos=0;
}
Buff::~Buff()
{
}
void Buff::Init(SDL_Renderer* screen, int type)
{
bool ret;
if(type==1) ret=LoadImage("Images//staff.png",screen);
else ret=LoadImage("Images//shield.png",screen);
}
void Buff::Show(SDL_Renderer* screen, bool is_show)
{
if(is_show==true)
{
rect_.x=x_pos;
rect_.y=y_pos;
Render(screen);
}
}