If this class is a subclass of my main class, it works. If I move it to its own class and add all the imports that Eclipse wants, I get an error.
import java.awt.Image;
import java.awt.Image.*;
import java.awt.image.CropImageFilter;
import java.awt.image.FilteredImageSource;
import java.util.HashMap;
import java.util.Map;
public class Chara {
//Create a list for the Sprite images
//ArrayList<Sprite> sprite = new ArrayList();
Map<String, Sprite> sprite = new HashMap<String, Sprite>();
int angle;
int lastAngle;
int x;
int y;
float gx;
float gy;
public Chara(Image SpriteSheet)
{
sprite.put("fl", new Sprite());
sprite.get("fl").img = createImage(new FilteredImageSource(SpriteSheet.getSource(),
new CropImageFilter(0, 0, 32, 32)));
}
}
The error is: The method createImage(FilteredImageSource) is undefined for the type Chara
I don’t know how to fix it.