So I have a problem.
I have a drop falling, if it touches a plate, something happens oO. My Drop.class has a speed set as
moveY is definded in class itself (all above) as a value of 10, not in the act method.
Then, in my Plate.class
The plate becomes Slippy and I set an int variable at 5. In the act method of the Plate.class, I just put a bloppy--;
so at the beginning, bloppy = 0, when the drop hits the plate, bloppy = 5 and decrease.
Then I added this still in my Plate.class:
But actually, nothing is working. The image of the drop is changed, but it doesnt disappear and I get a java console error message :
java.lang.NullPointerException
which redirects me to line :
Thanks a lot guys !
//In act method setLocation(getX(), getY() + moveY);
Drop drop = (Drop)getOneIntersectingObject(Drop.class); if(drop != null) { isSlippy = true; bloppy = 5; }
if(bloppy > 0) { drop.moveY = 0; drop.setImage("blop.png"); } if(bloppy == 0) { getWorld().removeObject(drop); }
if(bloppy > 0) { drop.moveY = 0; //This line drop.setImage("blop.png"); }