|
Notice how we now have a state machine going, with a "pre-run" phase for starting the game! It's much cleaner, and quite obvious what's going on. There's a bit of scope magic in use to keep the borrow-checker happy: if you declare and use a variable inside a scope, it is dropped on scope exit (you can also manually drop things, but I think this is cleaner looking).
|
|
Notice how we now have a state machine going, with a "pre-run" phase for starting the game! It's much cleaner, and quite obvious what's going on. There's a bit of scope magic in use to keep the borrow-checker happy: if you declare and use a variable inside a scope, it is dropped on scope exit (you can also manually drop things, but I think this is cleaner looking).
|
|
Lastly, we modify `monster_ai_system` to only run if the state is `MonsterTurn` (snippet):
|
|
Lastly, we modify `monster_ai_system` to only run if the state is `MonsterTurn` (snippet):
|
|
@@ -759,4 +759,4 @@ That was quite the chapter! We added in location indexing, damage, and killing t
|
|
Copyright (C) 2019, Herbert Wolverson.
|
|
Copyright (C) 2019, Herbert Wolverson.
|