June 2021
Beginner
344 pages
8h 9m
English
Let’s start by making the monsters do something: move randomly through the dungeon. This isn’t the overall behavior you’ll keep for the finished game, but it can still be useful later. For example, adding Confusion effects may force an entity to move randomly. Bats and other irritants might flap randomly around the map. Like most ECS systems, the random movement system provides an option for you to use when adding functionality to your game.
You need a way to indicate that an entity moves randomly. This is best accomplished with a simple component—anything that has the component will wander aimlessly around the map. In components.rs, create a new tag component:
| | #[ ... |
Read now
Unlock full access