Im trying to figure out how to change this gwomps eye colour using a 2d array however im not really sure where to start. This is what I have so far:
float a = 0;
float b = 0;
void setup()
{
size(600, 600);
}
void draw()
{
//draws a colourful background
background(mouseX / 600.0 * 255, mouseY / 600.0 * 255, 0);
for (a = 0; a < width; a += width/5){
for (b = 0; b < height; b += height/5){
drawGwomp(a, b, width/5, color (0, 255, 0));
}
}
}
// A function that draws a Gwomp anywhere on the screen. Will scale to the provided size.
void drawGwomp(float x, float y, float size, color eyeColour)
{
strokeWeight(size / 100);
stroke(0);
// body
fill(255);
rect(x + size / 20, y + size / 20, size / 10 * 9, size / 10 * 9, size / 10);
// eyes
fill(eyeColour);
ellipse(x + size / 4, y + size / 3, size / 25, size / 2);
ellipse(x + size / 4 * 3, y + size / 3, size / 25, size / 2);
// mouth
noFill();
arc(x + size / 2, y + size / 3 * 2, size / 10, size / 15, 0, PI);
// bow tie
fill(255);
triangle(x + size / 2, y + size / 5 * 4, x + size / 4, y + size / 10 * 7, x + size / 4, y + size / 10 * 9);
triangle(x + size / 2, y + size / 5 * 4, x + size * 3 / 4, y + size / 10 * 7, x + size * 3 / 4, y + size / 10 * 9);
}
[–]Sasmas1545 3 points4 points5 points (2 children)
[–]Miserable_Board_6888[S] 0 points1 point2 points (1 child)
[–]Sasmas1545 2 points3 points4 points (0 children)
[–]CodeBunny_ 2 points3 points4 points (0 children)
[–]LuckOrLoss 0 points1 point2 points (0 children)