Nullpointerexception (Uh-oh)
in
Programming Questions
•
1 years ago
Hey, guys, I'm on my most hated error, since they always take forever for me too find/fix. I have a boolean in a class with a value referenced in another class, like this.
Thanks,
Blake.
- jump(int ix, nicolai inn, block ibb){
- jx=ix;
- nn=inn;
- bb=ibb;
- }
- if(bb.bx<nn.nx+25-x&& bb.bx>nn.nx-25-x&& bb.by>=nn.y+35){
- onblock=true;
- }else{onblock=false;}
- class block{
- float bx,by;
- nicolai nn;
- boolean hit=false;
- block(int ix, int iy, nicolai inn){
- bx=ix;
- by=iy;
- cy=iy;
- nn=inn;
- }
- void display(){
- imageMode(CENTER);
- image(e,bx+x,cy,15,15);
- image(c,bx+x,by,20,20);
- }
- void update(){
- if(nn.nx>bx-15+x && nn.nx<bx+15+x
- && nn.y<=by+35 && nn.y>=by-25){
- hit=true;
- nn.yvel=2;
- }
- if(nn.nx>=bx-25+x && nn.nx<=bx+25+x &&
- nn.y<=by+35 && nn.y>=by-25){
- xvel=0;
- xacc=0;
- }
- }
Thanks,
Blake.
1