Like the title says, I would appreciate if someone could show me how to do this.
I tried to do it, but I don’t quite understand how it works.
When I experimented with it, I tried to push one string and one function named “moveRight” into the array,
_behaviours.push("1", moveRight);
trace("_behaviours: " +_behaviours);
but when I trace the content of the array, I get
_behaviours: 1,function Function() {}
why is my function moveRight, being renamed to “Function”, and how do I call the different functions if I have several of them in one array?
The purpose of all this is to make a simple AI system for my game enemies. After the enemies are added to stage, a special function would calculate a random number based on the number of entries in the array and then make the enemy perform the chosen function.
Thanks in advance!