Skip to content

Commit

Permalink
Fix bug where player could keep playing after dying from hunger
Browse files Browse the repository at this point in the history
  • Loading branch information
wendelscardua committed Oct 5, 2023
1 parent 045bfa3 commit 8ce18d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion docs/plans.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Things to do - postjam
- [ ] BUG: player can ressurect (!?)
- [ ] more food when completing lines
- [ ] avoid spawning on player and on food
- [ ] spawn polyomino on a viable column
Expand Down
5 changes: 3 additions & 2 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ void Player::hunger_upkeep(s16 delta) {
}

void Player::update(InputMode input_mode, u8 pressed, u8 held) {
if (state != State::Dying && state != State::Dead) {
hunger_upkeep(1);
}
switch (state) {
case State::Idle: {
hunger_upkeep(1);
auto current_row = y.whole >> 4;
auto current_column = x.whole >> 4;
auto current_cell = board.cell[current_row][current_column];
Expand Down Expand Up @@ -89,7 +91,6 @@ void Player::update(InputMode input_mode, u8 pressed, u8 held) {
}
} break;
case State::Moving:
hunger_upkeep(1);
switch (moving) {
case Direction::Up:
y -= move_speed;
Expand Down

0 comments on commit 8ce18d4

Please sign in to comment.