In order to complete this assignment with a pop art theme, I have chosen to incorporate pokeballs into the design. The task at hand involves using two for loops, one for the top row and one for the bottom row, while also creating a function. The main challenge I am facing is figuring out how to randomly generate 2 additional pokeballs in the top row (for a total of 6 pokeballs: 3 on top and 3 on the bottom) using a function call.
var RANDCOL = random(0, 400);
var XBALL = 65;
var YBALL = 108;
//dividing tiles
fill(250, 0, 0);
rect(0, 0, 130, 200);
fill(0, 187, 255);
rect(131, 0, 137, 200);
fill(0, 0, 0);
rect(269, 0, 130, 200);
fill(167, 158, 235);
rect(0, 200, 131, 199);
fill(46, 184, 101);
rect(131, 200, 137, 199);
fill(255, 0, 0);
rect(269, 200, 130, 199);
//pokeball specifications
var pokeBall = function(x) {
stroke(158, 214, 235);
ellipse(XBALL, YBALL, 99, 97);
fill(0, 0, 0);
stroke(0, 0, 0);
line(15, 109, 56, 109);
line(116, 109, 72, 109);
ellipse(64, 108, 19, 16);
};
//loop for top row
for(var i = 0; i < 3; i++) {
var x = i * 134;
fill(RANDCOL);
pokeBall();
}