All code to be done in processing software, free downloadable software from processing.org Assignment Instructions Video attached for further visual explanation 1. Write code to define 4 parallel...

1 answer below »
All code done through the processing software, free download from processing.org
Instructions and video example attached below


All code to be done in processing software, free downloadable software from processing.org Assignment Instructions Video attached for further visual explanation 1. Write code to define 4 parallel arrays to store info for unlimited balls (right now we do not know the size). The names of the parallel arrays are: a. xPos b. yPos c. xSpeed d. ySpeed e. ballColors   2. Write a function addBall with following features: 1. a. It does not return any value b. Takes in the following parameters: i. X co-ordinate of the ball ii. Y co-ordinate of the ball iii. Color of the ball c. Goal of addBall: to make changes to the following arrays: i. Append the first paraeter to the array xPos. ii. Append the second parameter to the array yPos. iii. Append a random value between 2 and 5 to the array xSpeed. iv. Append a random value between 3 and 7 to the array ySpeed. v. Append the third parameter to the array ballColors.   3. Inside void setup() do the following: a. Code a for-loop that runs 5 times. Inside the loop body,  write code to call addBall with random values for the first 2 parameters and color white as the value for the 3 rd parameter. 4. Inside void mousePressed () : a. Call addBall once with mouseX , mouseY as values to first 2 parameters and a random color as the 3rd parameter 5. Inside void draw() : a. Using a for-loop, make sure to draw all the balls with the information in the arrays xPos, yPos, xSpeed, ySpeed, ballColors. Lavf58.12.100
Answered Same DaySep 22, 2021

Answer To: All code to be done in processing software, free downloadable software from processing.org...

Ramachandran answered on Sep 22 2021
137 Votes
Order-91729/bouncing_balls/bouncing_balls.pde
//list of integer
IntList xPos = new IntList();
Int
List yPos = new IntList();
IntList xSpeed = new IntList();
IntList ySpeed = new IntList();
IntList ballColors = new IntList();
int ballRadius = 80;
int maxWidth = 750;
int maxHeight = 800;
color white = color(255);
void setup(){
size(750, 800);
stroke(0);

for(int i=0;i<5;i++){
addBall(randomInt(0, maxWidth), randomInt(0, maxHeight), white);
}
}
void draw(){
background(255);
for(int i=0;i ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here