April 2017
Beginner to intermediate
394 pages
9h 16m
English
Let's say we're going to create a simple enemy. This enemy will not do anything by default, but if the player is nearby, it will move toward them. However, if the player gets too far away from them, then they will stop their pursuit. Finally, if the player shoots the enemy, it will die. So, keeping that in mind, we can extract the states that we'll need. They are as follows:
While we are creating our State Machine, we need some way to keep track of what state our objects are going to be in. One may think a way to do this would be to have a bool (Boolean value of true or false) for each possible state there is and then set them all to false, except for the state that we're in. This is a very ...
Read now
Unlock full access