I'm working on an algorithmic animation of an insect moving around the screen. I've got a class for the insect, and a variety of methods which set different behaviours for the insect, such as whether it's moving, what direction it's moving in, which way it's pointing its head, etc. I also have a draw() method in my insect class, and use it to draw the insect based on how the behaviour methods have set the insect's parameters.
My question is: Where should I be calling the insect's behaviour methods from? I've tried setting it up in a few different ways, and I seem to run into problems no matter what I do.
I thought at first that my method calls should be inside of the main draw() method for the sketch, but this makes certain things difficult (or maybe I just setting them up the wrong way). I then tried making a run() method in the insect class and calling it at the end of my setup() method. I found that this was also difficult to work with.
What would be the standard way to set up this sort of thing?
My question is: Where should I be calling the insect's behaviour methods from? I've tried setting it up in a few different ways, and I seem to run into problems no matter what I do.
I thought at first that my method calls should be inside of the main draw() method for the sketch, but this makes certain things difficult (or maybe I just setting them up the wrong way). I then tried making a run() method in the insect class and calling it at the end of my setup() method. I found that this was also difficult to work with.
What would be the standard way to set up this sort of thing?
1