The problem with using the isGround method in Egg is because there is a problem in WorldLoader. The problem is that you're doing "Color ez = bgmask.getColorAt(x,y);" but the variable bgmask wasn't defined so it's equal to null.
public void testLvl()
{
background= new GreenfootImage("MaskTest.png");
setBackground(background);
bgmask = new GreenfootImage("MaskTest.png");
startx= 100;
starty=500;
addObject(new Egg(), startx,starty);
}public void physics()
{
x+=xspeed;// when moving left or right
y+=yspeed;// fall speed
xspeed *=0.91;//used to slow down but will never reach 0 cuz science!
}private void Grounds()
{
if (world.isGround(getX(), getY()+16))
{ yspeed = 0;
canjump = true; }// to check if standing on the color black
if (world.isGround(getX(), getY()+14) )
{ y -= 1;}//
if (world.isGround(getX(), getY()-14) )
{ y += 1;
if (yspeed < 0){yspeed = 0;}
}//to check if under color black
if (world.isGround(getX()+14, getY()) )
{ x -= 1;
if (xspeed > 0) {xspeed = 0;}
}// to check if trying to run into color black from the right side
if (world.isGround(getX()-14, getY()) )
{ x += 1;
if (xspeed < 0) {xspeed = 0;}
}// to check if trying to run into color black from left side
}