I was working on doing some level desing tests and I used the Slick2d getColor(x,y) method. I used it in a for loop that looped through the x and y axis but no matter what it only ever returns the pixel it starts with. I am not sure if this is a bug or what?
public static Level LoadLevel(String filename) throws SlickException{
Image map = new Image(filename);
int w = map.getWidth();
int h = map.getHeight();
Level level = new Level(w,h);
Color color;
for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){
color = map.getColor(x, y);
System.out.println(x + ", " + y +" Color: " + color);
Tile tile = new EmptyTile();
if(color == Color.decode("0x000000")){
tile = new SolidTile();
}
level.SetTile(x, y, tile);
}
}
return level;
}
Edit: I tried to work it out for a little while longer and it can read the color from the map but when it compairs to the data I have it rejects both of them.