Change 50 in line 35 to 100.
double distance = Math.hypot(x1, y1);
Actor missile = new Missile(); getWorld().addObject(missile, getX(), getY()); missile.setRotation(getRotation());
import greenfoot.*;
public class Background01 extends World
{
private int scrollSpeed = 2;
private int picHeight;
private GreenfootImage bgImage;
private int scrollPosition;
GreenfootSound bgMusic;
public Background01()
{
super(900, 600, 1);
bgImage = new GreenfootImage(getBackground());
picHeight = bgImage.getHeight();
Greenfoot.start();
bgMusic = new GreenfootSound("Star Wars.mp3");
bgMusic.play();
}
public void act()
{
scrollPosition -= scrollSpeed;
while(scrollSpeed > 0 && scrollPosition < -picHeight) scrollPosition += picHeight;
while(scrollSpeed < 0 && scrollPosition > 0) scrollPosition -= picHeight;
paint(scrollPosition);
if (!bgMusic.isPlaying()) Greenfoot.setWorld(new Background02());
}
private void paint(int position)
{
GreenfootImage bg = getBackground();
bg.drawImage(bgImage, 0, position);
bg.drawImage(bgImage, 0, position + picHeight);
}
}