Skip to content

Commit

Permalink
Preparing to make NPCs move autonomously. A "wait" command will be im…
Browse files Browse the repository at this point in the history
…plemented and triggered by the space bar.
rpruizc committed Sep 10, 2020
1 parent 668cdae commit 9d18254
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ impl AppData {
KeyboardInput::Right => self.game_state.maybe_move_player(CardinalDirection::East),
KeyboardInput::Up => self.game_state.maybe_move_player(CardinalDirection::North),
KeyboardInput::Down => self.game_state.maybe_move_player(CardinalDirection::South),
KeyboardInput::Char(' ') => self.game_state.wait_player(),
_ => (),
},
_ => (),
4 changes: 4 additions & 0 deletions src/game.rs
Original file line number Diff line number Diff line change
@@ -77,4 +77,8 @@ impl GameState {
self.visibility_grid
.update(player_coord, &self.world, &mut self.shadowcast_context);
}

pub fn wait_player(&mut self) {
self.ai_turn();
}
}

0 comments on commit 9d18254

Please sign in to comment.