My professor assigned this assignment and I just can’t figure out how to do it. Can anyone help me out or at least give me a head start. I’ve been trying to figure it out all day today and I get more and more confused. Thank you
Create an array of objects. Each object should have the following properties:
- A name, stored as a string (text)
- A number from 0-255 (call it hue), populated using p5’s random function.
- A boolean (true/false) value (called redOrBlue)
Create a for loop that iterates over all of the objects in the above array. In each iteration of the for loop, print that object’s name. If that object’s redOrBlue flag is true, then the text should be red, with a value of that object’s hue property (eg
fill(obj.hue, 0, 0); ). If the flag is false, then the text should be blue with a value of the object’s hue property (
fill(0, 0, obj.hue); ) All of the text names should appear on the screen at once.