so my character can move up and down but i want to limit its going up so it dont reach the "sky" of the scenario
//At the class beginning
private final int maxHeight = 0;
//In your act method
if(Greenfoot.isKeyDown(„up“)&&getY()<maxHeight){
serLocation(getX(), getY - dir);
}
if (Greenfoot.isKeyDown("up") && getY() > maxHeight)if (Greenfoot.isKeyDown("up") && getY() > maxHeight)