Keywords, labels, and latent functions
Just a few other things we need to discuss about states, keywords, labels, and latent functions. Let's start by going over the keywords we can use in states.
Keywords
One keyword that we've already been using is auto
; it designates the state as the one the actor will start in when it is created. Only one state can have the auto
keyword, but if we wanted to we could have no states with it. In that case, the actor will only use the non-state functions until it enters one of the states.
The other keyword we can use with states is ignores
. Unlike auto
, ignores
goes inside the state at the top, before any functions are declared. Using ignores
tells the state not to use the functions we tell it to while it's in this state. It has the same effect as declaring the function and leaving it empty, but it's a lot cleaner to use ignores
. Let's see if we can use it in our AwesomeEnemy
class.