-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to level-based upgrade system and implement end-of-run scene
- Loading branch information
1 parent
cd2d6ec
commit fe09d13
Showing
28 changed files
with
563 additions
and
632 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include <glm/vec3.hpp> | ||
|
||
namespace linguine { | ||
|
||
struct Toast { | ||
glm::vec3 startPosition = glm::vec3(0.0f); | ||
float duration = 1.0f; | ||
float elapsed = 1.0f; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
namespace linguine { | ||
|
||
struct Wallet {}; | ||
struct CurrentXp {}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
namespace linguine { | ||
|
||
struct LevelTracker { | ||
LevelTracker(int32_t startXp, int32_t endXp) | ||
: startXp(startXp), endXp(endXp) {} | ||
|
||
int32_t startXp; | ||
int32_t endXp; | ||
|
||
float duration = 1.0f; | ||
float elapsed = 0.0f; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
namespace linguine { | ||
|
||
struct PlayButton {}; | ||
struct RequiredXp {}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#pragma once | ||
|
||
#include <array> | ||
|
||
namespace linguine { | ||
|
||
class LevelCurve { | ||
public: | ||
static constexpr uint8_t MaxLevel = 20; | ||
|
||
static constexpr uint8_t getLevelForXp(int32_t xp) { | ||
auto level = 0; | ||
auto xpToLevel = 0; | ||
|
||
for (auto xpIncreasePerLevel : _xpIncreasePerLevel) { | ||
xpToLevel += xpIncreasePerLevel; | ||
|
||
if (xp >= xpToLevel) { | ||
xp -= xpToLevel; | ||
++level; | ||
} else { | ||
break; | ||
} | ||
} | ||
|
||
return level; | ||
} | ||
|
||
static constexpr int32_t getXpPerLevel(uint8_t level) { | ||
auto result = std::array<int32_t, MaxLevel>(); | ||
|
||
auto xpRequired = 0; | ||
|
||
for (auto i = 0; i < _xpIncreasePerLevel.size(); ++i) { | ||
xpRequired += _xpIncreasePerLevel[i]; | ||
result[i] = xpRequired; | ||
} | ||
|
||
return result[level - 1]; | ||
} | ||
|
||
static constexpr int32_t getXpForLevel(uint8_t level) { | ||
auto xp = 0; | ||
|
||
for (auto i = 1; i <= level; ++i) { | ||
xp += getXpPerLevel(i); | ||
} | ||
|
||
return xp; | ||
} | ||
|
||
private: | ||
static constexpr std::array<int32_t, MaxLevel> _xpIncreasePerLevel = { | ||
0, 25, 25, 25, 50, | ||
25, 25, 25, 25, 50, | ||
25, 25, 25, 25, 50, | ||
25, 25, 25, 25, 50 | ||
}; | ||
}; | ||
|
||
} // namespace linguine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.