Hi Guysi have Problem concerning my PONG game. Id like the paddles to reset on their location off the beginning off the game. Ive done if the ball has a certain Y Coordinate it needs to reset the ball and set the counter higher. This works just fine, until I add this line of Code :The Compiling is also working just fine but if the IF Statement kicks in it just gives me this error in an separate Window: java.lang.NullPointerException
Here is the complete If Statement :
Hope y'all can help me ;-)
Actor Rightplayer = getOneIntersectingObject(Rightplayer.class); Rightplayer.setLocation(300, 200);
if(getX()<10) { getWorld() != null; deltaX = -7; deltaY = 0; World myWorld = getWorld(); this.setLocation(300,200); // Playerleft.setLocation(10,20); Background Background = (Background)myWorld; Scoreleft Scoreleft = Background.getScoreleft(); Scoreleft.addScore(); Greenfoot.delay(40); Actor Rightplayer = getOneIntersectingObject(Rightplayer.class); Rightplayer.setLocation(300, 200);