feat: add finite lifetimes and despawn mechanics for rotten and cursed apples
This commit is contained in:
1 parent
9a3a0bd9fd
commit
adda5db2f4
8 files changed
+159
-82
No files matched your search
@@ -32,6 +32,13 @@ struct Barrier {
|
||||
uint16_t framesLeft = 0; // Frames remaining in the current phase
|
||||
};
|
||||
|
||||
// Evil item (rotten apple or cursed apple) with position and lifetime in game ticks
|
||||
struct EvilItem {
|
||||
int8_t x = 0;
|
||||
int8_t y = 0;
|
||||
uint16_t ticksRemaining = 0;
|
||||
};
|
||||
|
||||
struct GameState {
|
||||
volatile uint16_t ticks = 0;
|
||||
volatile uint16_t snakelength = 0;
|
||||
@@ -55,8 +62,8 @@ struct GameState {
|
||||
|
||||
std::deque<std::array<int, 3>> snake;
|
||||
std::vector<std::array<int, 2>> apples;
|
||||
std::vector<std::array<int, 2>> bad_apples;
|
||||
std::vector<std::array<int, 2>> cursed_apples;
|
||||
std::vector<EvilItem> bad_apples;
|
||||
std::vector<EvilItem> cursed_apples;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user