We’ve looked at box cars and forests, now let’s build a crowd.
Rx: <20 min Av: 20-40 min Sd: 40-60 min DNF: 60+ min
Picture_uLoginPerson class.Circle head field and a Rectangle body. (You may optionally create additional fields for arms, face, hat, etc.)x, y, and width.x, y, width, headColor and bodyColor.setBounds method that:
x, y, & widthx - width / 2, y and extends to width & height. Note that the x position is in the middle of the person.setBounds method from the constructor.draw method that takes a Graphics parameter and calls the draw methods of the 2 fieldsheadColor and bodyColor.Person in your Picture class to test your code. When satisfied, move on to create a crowd.Crowd class with:
Person fields or a single ArrayList<Person> field. When drawn, the people should overlap a little bit. For example, you could put two people behind the front person by reducing their size by 75% and putting them a little to the left and right of the front & centered person:
x, y, width. The width represents the overall width of the crowd, not an individual person.draw method that has a Graphics parameter and calls the corresponding draw methods for the people.Crowd class by replacing your Person field(s) in the Picture class. Crowd fields to your Picture (for a total of 3). Modify the position & sizes in the Picture class so each crowd looks a little bit different.