I will add that if the object changing the var direction
is the same one that owns the var direction
(a common case, for example with a player scene), then the setter wont trigger. In that case you have to use self
when changing the var, for example:
func change_dir():
self.direction = new_value
Clarifing this, because it is a common pitfall when learning to use setters and getters, that I have personally fallen into