I dont understand why i get null pointer exception
in
Programming Questions
•
11 months ago
HI
I get nullpointer in my void init(); could you explain me why?
I need to more define the void init()?
--------------------------------
int x1,y1;
int c;
void setup(){size(300,300);
c=0;
x1=25;y1=25;
}
void draw(){
if(c<50){
init();
}
if(mousePressed&&mouseX>x1&&mouseX<x1+50&&mouseY<y1+50&&mouseY>y1)
{c=100;}
if(c>50){c=100;movec();}
}
void init(){
background(120);
rect(x1,y1,50,50);
}
void movec(){translate(mouseX-x1,mouseY-y1);background(255);rect(x1,y1,50,50);
}
1