Add cursed apple: a status-effect apple that inverts controls
Eating a cursed apple inverts the snake's steering for CURSE_DURATION_TICKS ticks, shown on the top screen while active. The sprite is a recolored copy of the rotten-apple tile since all existing sprite tiles are already in use.
This commit is contained in:
1 parent
df9b859601
commit
0e7477031f
8 files changed
+96
-5
No files matched your search
@@ -5,6 +5,7 @@
|
||||
const int START_LENGTH = 4;
|
||||
const int START_LENGTH_HARD =2;
|
||||
const int APPLE_SCORE = 10;
|
||||
const int CURSE_DURATION_TICKS = 40;
|
||||
|
||||
//Screen size
|
||||
const int X_MAX = 31;
|
||||
|
||||
@@ -7,7 +7,10 @@ void update_snake(GameState &state);
|
||||
bool check_collision_self(GameState &state);
|
||||
bool check_collision_apples(GameState &state);
|
||||
bool check_collision_apples_rotten(GameState &state);
|
||||
bool check_collision_apples_cursed(GameState &state);
|
||||
void spawn_apples(GameState &state);
|
||||
void spawn_apples_rotten(GameState &state);
|
||||
void spawn_apples_cursed(GameState &state);
|
||||
void tick_status_effects(GameState &state);
|
||||
|
||||
#endif
|
||||
@@ -15,6 +15,7 @@ struct RenderAssets {
|
||||
u16 *gfx_apple = nullptr;
|
||||
u16 *gfx_tail = nullptr;
|
||||
u16 *gfx_apple_rotten = nullptr;
|
||||
u16 *gfx_apple_cursed = nullptr;
|
||||
};
|
||||
|
||||
void draw_game(const GameState &state, const RenderAssets &assets);
|
||||
|
||||
@@ -16,9 +16,12 @@ struct GameState {
|
||||
bool paused = false;
|
||||
bool hardMode = false;
|
||||
|
||||
uint16_t curseTicksRemaining = 0;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user