is their a way to move my object left or right in the world and stop before it actually hits the edge of the world?
if (Greenfoot.isKeyDown("left") && getX()>10){
setLocation(getX()-1, getY());
}if (Greenfoot.isKeyDown("left") && getX()>10+getImage().getWidth()/2){
setLocation(getX()-1, getY());
}if (Greenfoot.isKeyDown("right") && getX()<getWorld().getWidth()-getImage().getWidth()/2-10)