This week my main focus was to make my code from last week more concise. I want to continue building on my game idea, eventually creating a timer, levels and more challenging interactions. My code went from almost 400 lines to 97.
I first created a constructor function and made parameters for each part of the bouncer. The color refers to the original color of each ball and the target, which is seen in the next part refers to the color the ball turns into after being clicked.
For the palette array that I defined previously, I hardcoded the color values. Since there are 10 balls, I created 10 color values to be assigned to each.
Below I pasted each screenshot of the game sketch. Each ball begins grey and as they are clicked they turned into their assigned color.