i did this and it worked but i want it to go from bottom to top
import greenfoot.*;
public class Background extends World
{
private static final String bgImageName = "brick.jpg";
private static final double scrollSpeed = 2.5;
private static final int picWidth = (new GreenfootImage(bgImageName)).getHeight();
private GreenfootImage bgImage, bgBase;
private int scrollPosition = 0;
public Background()
{
super(800, 400, 1);
setBackground(bgImageName);
bgImage = new GreenfootImage(getBackground());
bgBase = new GreenfootImage(getWidth(), picWidth);
bgBase.drawImage(bgImage, 0, 0);
}
public void act()
{
scrollPosition -= scrollSpeed;
while(scrollSpeed > 0 && scrollPosition < -picWidth) scrollPosition += picWidth;
while(scrollSpeed < 0 && scrollPosition > 0) scrollPosition -= picWidth;
paint(scrollPosition);
}
private void paint(int position)
{
GreenfootImage bg = getBackground();
bg.drawImage(bgBase, 0, position);
bg.drawImage(bgImage, 0, position + picWidth);
}
}

