package background;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

import sound.ResourceLoader;
import core.Actor;
import core.State;

/**
 * Holds a background and its function to alter the movement
 * @author Vinzenz Boening
 */
public class BackgroundActor extends Actor{

	public static enum Type{
		TREE ("res/bg/treehuge.png"),
		DIRT ("res/bg/dirt.png");
		
		private final String path;
		Type(String path){
			this.path = path;
		}
		public String getPath(){
			return path;
		}
	}
	  
	private static final long serialVersionUID = -7327728536198764908L;
	
	private double speed = 0.0008;
	private BufferedImage bimage;
	
	public BackgroundActor(State parent, double x, double y, Type type) {
		super(parent, x, y);
		try{
			bimage = (BufferedImage) ResourceLoader.load(type.getPath());
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	public void update() {
		x+=speed;
	}

	public void setSpeed(double speed){
		this.speed = speed;
	}
	public double getSpeed(){
		return speed;
	}

	public void paintComponent(Graphics g){
		Graphics2D g2D = (Graphics2D) g;		
		g2D.drawImage(bimage, parent.getCoordX(x), parent.getCoordY(y), parent.getWidth(w), parent.getHeight(h), null);
	}
	
}

@@ -894,46 +894,181 @@
 %09%7D%0A%09
-public void update() %7B%0A%09%09x+=speed;%0A%09%7D%0A
+%0A%09/**%0A%09 * Updates the position of this actor%0A%09 */%0A%09public void update() %7B%0A%09%09x+=speed;%0A%09%7D%0A%09%0A%09/**%0A%09 * Set the speed of this actor%0A%09 * %0A%09 * @param speed the vertical speed%0A%09 */
 %0A%09pu
@@ -1126,16 +1126,60 @@
 eed;%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Get the speed of this actor%0A%09 */%0A
 %09public 
@@ -1217,16 +1217,61 @@
 ed;%0A%09%7D%0A%0A
+%09/**%0A%09 * Paints the actor on the screen%0A%09 */%0A
 %09public 

Update BackgroundActor.java