-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_settings.cpp
86 lines (79 loc) · 2.04 KB
/
game_settings.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "game_settings.hpp"
#include <algorithm>
void GameSettings::setEnemyWaves(int waves) {
enemyWaves = std::clamp(waves, MIN_ENEMY_WAVES, MAX_ENEMY_WAVES);
}
void GameSettings::cycleDifficulty() {
switch (difficulty) {
case Difficulty::Easy:
difficulty = Difficulty::Medium;
break;
case Difficulty::Medium:
difficulty = Difficulty::Hard;
break;
case Difficulty::Hard:
difficulty = Difficulty::Easy;
break;
}
}
void GameSettings::cycleDifficultyReverse() {
switch (difficulty) {
case Difficulty::Easy:
difficulty = Difficulty::Hard;
break;
case Difficulty::Medium:
difficulty = Difficulty::Easy;
break;
case Difficulty::Hard:
difficulty = Difficulty::Medium;
break;
}
}
int GameSettings::getMaxEnemyBullets() const {
switch (difficulty) {
case Difficulty::Easy:
return 1;
case Difficulty::Medium:
return 2;
case Difficulty::Hard:
return ABSOLUTE_MAX_ENEMY_BULLETS;
default:
return 1;
}
}
float GameSettings::getEnemyBaseSpeed() const {
switch (difficulty) {
case Difficulty::Easy:
return 2.0f;
case Difficulty::Medium:
return 3.0f;
case Difficulty::Hard:
return 5.0f;
default:
return 2.0f;
}
}
float GameSettings::getEnemyAmplitude() const {
switch (difficulty) {
case Difficulty::Easy:
return 10.0f;
case Difficulty::Medium:
return 15.0f;
case Difficulty::Hard:
return 20.0f;
default:
return 10.0f;
}
}
float GameSettings::getEnemyFrequency() const {
switch (difficulty) {
case Difficulty::Easy:
return 0.03f;
case Difficulty::Medium:
return 0.05f;
case Difficulty::Hard:
return 0.07f;
default:
return 0.03f;
}
}