forked from thoth-tech/build-a-game-team
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhud.h
92 lines (82 loc) · 3.71 KB
/
hud.h
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
#include "splashkit.h"
#include "player.h"
#include <memory>
#pragma once
class HUD
{
private:
//Added the current level players so you have easy access to them
vector<std::shared_ptr<Player>> level_players;
void high_score()
{
// To Be Done.
}
public:
HUD(vector<std::shared_ptr<Player>> level_players)
{
this->level_players = level_players;
};
~HUD(){};
void update()
{
draw_text("HEALTH: ", COLOR_WHITE, "DefaultFont", 9, 60, 100, option_to_screen());
draw_text("LIVES: ", COLOR_WHITE, "DefaultFont", 9, 60, 70, option_to_screen());
if(level_players.size() > 1 )
{
draw_bitmap("PinkEmptyBar", 125, 80, option_part_bmp(0, 0, 64, 32, option_to_screen()));
draw_bitmap("PinkHealthBar", 125, 80, option_part_bmp(0, 0, 64/3*level_players[1]->player_health, 32, option_to_screen()));
if(level_players[1]->player_lives==3)
{
draw_bitmap("PinkLive", 190, 55, option_to_screen());
draw_bitmap("PinkLive", 155, 55, option_to_screen());
draw_bitmap("PinkLive", 120, 55, option_to_screen());
}
if(level_players[1]->player_lives==2)
{
draw_bitmap("PinkLive", 155, 55, option_to_screen());
draw_bitmap("PinkLive", 120, 55, option_to_screen());
}
if(level_players[1]->player_lives==1)
{
draw_bitmap("PinkLive", 120, 55, option_to_screen());
}
draw_bitmap("BlueEmptyBar", 270, 80, option_part_bmp(0, 0, 64, 32, option_to_screen()));
draw_bitmap("BlueHealthBar", 270, 80, option_part_bmp(0, 0, 64/3*level_players[0]->player_health, 32, option_to_screen()));
if(level_players[0]->player_lives==3)
{
draw_bitmap("BlueLive", 335, 55, option_to_screen());
draw_bitmap("BlueLive", 300, 55, option_to_screen());
draw_bitmap("BlueLive", 265, 55, option_to_screen());
}
if(level_players[0]->player_lives==2)
{
draw_bitmap("BlueLive", 300, 55, option_to_screen());
draw_bitmap("BlueLive", 265, 55, option_to_screen());
}
if(level_players[0]->player_lives==1)
{
draw_bitmap("BlueLive", 265, 55, option_to_screen());
}
}
else
{
draw_bitmap("PurpleEmptyBar", 125, 80, option_part_bmp(0, 0, 64, 32, option_to_screen()));
draw_bitmap("PurpleHealthBar", 125, 80, option_part_bmp(0, 0, 64/3*level_players[0]->player_health, 32, option_to_screen()));
if(level_players[0]->player_lives==3)
{
draw_bitmap("PurpleLive", 190, 55, option_to_screen());
draw_bitmap("PurpleLive", 155, 55, option_to_screen());
draw_bitmap("PurpleLive", 120, 55, option_to_screen());
}
if(level_players[0]->player_lives==2)
{
draw_bitmap("PurpleLive", 155, 55, option_to_screen());
draw_bitmap("PurpleLive", 120, 55, option_to_screen());
}
if(level_players[0]->player_lives==1)
{
draw_bitmap("PurpleLive", 120, 55, option_to_screen());
}
}
};
};