Week 9 - Lists & Arrays
Week 9 - Lists & Arrays
For this project, I created a program that displays random positive affirmations when the user clicks the mouse. The positive affirmations are stored as strings in an array. I then created a function to pull a string at random from this array, as well as a random font and color (this was just for stylistic purposes). The challenges for this project were to figure out how to get only one item from the array to display at a time, then to change when the mouse clicked. At first, it would either only display one random item, but would only change if you ran the sketch again. Or, it would display all the items stacked on top of each other. After looking at the video for this week, the Processing reference, and some googling, I found a solution that seems suitable for this problem and incorporated and altered the code to fit my needs. I also think in the future I might try to just have the strings print in the order that they appear in the array, then once the user gets through the entire array, to display a message at the end. Another issue was to get the text with random fonts to align with the "You are" text on one line. The solution for this was to just put the new text on its own line below the "You are". I think this solution is actually better than having everything on one line like I originally wanted.