This week, I built functions outside of setup() and draw() to make repeated codes more organized and efficient. At first, I copied the entire section of animation part into a new function, but animals were not moving. I realized that since the function is called in draw(), the x coordinate is going back to zero every time. Then, I kept all x coordinates the same.
While making new functions, I had few questions:
why the buttonstate always return false not true?
why did the animation accelerated when I add more kinds of animals?