How do I get my 'space' background movine forward.?This will make my rocket look like it is moving forwards.
//in your world class private int imageCount = 0; private GreenfootImage bgImage = new GreenfootImage("imageName.png"); public void act() { imageCount -= 5; //(or any other value; small -> slow moving, big -> fast movement) drawBackgroundImage(); } public void drawBackgroundImage() { if (imageCount > bgImage.getWidth()) { imageCount += bgImage.getWidth(); } int temp = imageCount; getBackground().drawImage(bgImage, temp, 0); getBackground().drawImage(bgImage, temp + bgImage.getWidth(), 0); }
if (imageCount < -bgImage.getWidth()) {