Hands-On Rust: Missing changes to player_input.rs (Chap 8)

Title: Hands-On Rust: (Chapter 8 - Waiting as a Strategy)

After following the instructions in the text (as I read them at least, there is some ambiguity as to the placement of some code), pressing a non-movement key did not result in monsters moving.

To troubleshoot, I compared to the source text and found the following differences between my source, and the results of making changes in the book:

– I needed to remove

if turn_state.clone() != TurnState::AwaitingInput {
        return;
     }

at the top of the function.

– needed to move the let (player_entity,destination query outside of the if delta... if statement.

– had to ensure that the if !did_something if statement was outside of the if delta... if statement.

Maybe I missed something earlier on (perhaps added in beta 2, I’m not planning to start from scratch with each beta release :slight_smile: ), but a cursory search didn’t find where I missed these details.

2 Likes

Thanks again! I’ve put this into the tracker, and it’ll be in beta 3.

2 Likes