So I have this code, for a game I'm making. Whenever I run the game (not compile), it throws a null pointer exception. Do you know how I can fix this?
public class PADDLE extends Game
{
/**
* Act - do whatever the PADDLE wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int dx;
public void act(){
int x = Greenfoot.getMouseInfo().getX();
if ( x > 0 ) {
setLocation( getX() + dx , getY() );
}
}
}

