Functions-calling multiple times

On lesson 27 project guide, there is section that says function is called multiple times. Does anyone have a sample of code written where this is shown? All of the samples on bubble one do not appear to have a function called multiple times.

Hi @leslie.dillon,

I think the most important thing to remember is that the draw loop runs 30 times a second or so. So, any function call in the draw loop is called multiple times. For example, in the first game in bubble 1 (the bunny game), it is possible that there is a function that is called every time the user hits the space bar that causes the bunny to jump. Similar to this game where on line 114 and 118, the score() function is called each time the ball hits either goal. In this game, all the major functions of the game are broken up into functions. If you look at the draw loop on 118, each of those functions are called 30 times per second.

One thing we do in my class is split the class into small groups and play the games in bubble 1 and then have each group decide where the functions might exist to simplify the code.

Hope this helps