Replace line 9, which was:
with the following code lines:
1 | int myMaxY = getWorld().getHeight() - getImage().getHeight() / 2 ; |
1 2 | Ground ground = (Ground)getWorld().getObjects(Ground. class ).get( 0 ); int myMaxY = (ground.getY() - ground.getImage().getHeight() / 2 ) - getImage().getHeight() / 2 ; |