so I'm creating a code. In it, I wanted to make two eyes for the helmet. To do it, I need to create a function so that I can draw two ellipses in one function. After creating the design for the eyes, I found I hadn't closed that section which resulted in all of the shapes in my Processing file to be moved around the page. I then closed the section, but now I'm getting a NullPointerException. How do I fix this?
float Helmet_Ratio=.4;
int i=0;
void setup()
{
size(1280,720);
smooth();
}
void draw(){
eye(1200,300);
eye(1275,350);
}
void eye(int y, int z){
fill(0);
ellipse(y,z,15,15);
fill(0);
ellipse(y+75,z+0,15,15);
}
{
background(255); //This is where the problem begins
{
//Pattern Background
int x = 15;
if (x > 20) {
rect(0, 0, 55, 55);
}
if (x < 20) {
strokeWeight(3);
fill(0,200,0);
rect(0,0,25,25);
}
for (i=0; i<125; i++)
{
pushMatrix();
fill(0,32,32);
rotate(.75);
rect(0,i*12,1280,i/5);
popMatrix();
}
{
//Helmet 1 Red
strokeWeight(0);
translate(50,0);
fill(255,0,0);
ellipse(width/2.25,height/2,240,250);
//Helmet 1 Lense
beginShape();
endShape();
//Helmet 2 Blue
strokeWeight(0);
translate(250,0);
fill(51,51,255);
ellipse(width/2.25,height/2,200,195);
//Helmet 3 Yellow
strokeWeight(0);
translate(250,0);
fill(255,255,0);
ellipse(width/2.25,height/2,150,160);
//Helmet 4 Black
strokeWeight(0);
translate(-750,0);
fill(32,32,32);
ellipse(width/2.25,height/2,200,195);
//Helmet 5 Pink
strokeWeight(0);
translate(-225,0);
fill(255,102,255);
ellipse(width/2.25,height/2,150,160);
}
}
}