-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspace_to_dig_scene.cpp
71 lines (48 loc) · 1.88 KB
/
space_to_dig_scene.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
#include "Header.h"
void space_to_dig_scene::generate_pieses() {
enshure_cols_rows();
std::vector<circle> posible_poses;
for (int x = -cols / 2; x <= cols / 2; x += 5) {
posible_poses.emplace_back(x, -1 * (rows / 2), 1);
//std::cout << x << " " << -cols / 2 << '\n';
}
for (int i = 0; i < amount_of_pieces; i++) {
int new_pos_ind = rand_int(0, posible_poses.size() - 1);
int new_rad = rand_int(piece_rad - 4, piece_rad + 4);
circle new_circ = posible_poses[new_pos_ind];
new_circ.y += new_rad + new_circ.rad - 0.9f;
new_circ.rad = new_rad;
circles.push_back(new_circ);
posible_poses.erase(posible_poses.begin() + new_pos_ind);
posible_poses.push_back(new_circ);
}
}
void space_to_dig_scene::action() {
while (circles.size() > 0 && player->food - food_spend >= 0) {
take_the_food();
if (GetAsyncKeyState(VK_SPACE)) {
for (int i = 0; i < dig_efficiency; i++) {
if (circles.size() == 0) {
break;
}
circles.erase(circles.begin() + rand_int(0, circles.size() - 1));
something_changed = true;
}
}
render();
}
outtro();
}
void space_to_dig_scene::get_possible_loot() {
std::ifstream sword("sword.txt");
std::ifstream gamstone("gamstone.txt");
std::ifstream vase("vase.txt");
std::vector<loot> possible_loot = { loot(sword, "a sword", 7, 0, 0), loot(gamstone, "a gamstone", 8, 0, 0), loot(vase, "a vase", 6, 0, 0) };
//std::vector<loot> possible_loot = { loot(vase, "vase", 6, 0, 0) };
result_loot = possible_loot[rand_int(0, possible_loot.size() - 1)];
}
void space_to_dig_scene::change_dificulty() {
amount_of_pieces += difficulty_lewel * 22;
dig_efficiency -= difficulty_lewel;
food_spending += difficulty_lewel * 0.1;
}