so here is where the problem is
public void init(int worldSize, BufferedImage map){
this.worldSize = worldSize;
this.map = map;
//createChunks
int chunkW = map.getWidth() / worldSize;
int chunkH = map.getHeight() / worldSize;
int count = 0;
BufferedImage imgs[] = new BufferedImage[chunkW*chunkH];
for (int x = 0; x < worldSize; x++) {
for (int y = 0; y < worldSize; y++) {
imgs[count] = new BufferedImage(chunkW, chunkH, map.getType());
Chunk chunke = new Chunk(x*8*32, y*8*32,imgs[count++]);
chunkList.add(chunke);
System.out.println(count+" IMG: "+map.getData()+" RGB: "+map.getRGB(x, y));
}
}
for(Chunk chunks : chunkList){
chunks.initChunk();
}
}
what i’am trying to do is get 8 pixels out off the BF and create a chunk out off it then jump another 8 pixels and make a new chunk but they are all black when they go into the array why?
tell me if you need more info this is the chunk init
public void initChunk(){
if(currChunkImg != null){
for(int w = 0; w < chunkSize; w++){
for(int h = 0; h < chunkSize; h++){
int rgb = currChunkImg.getRGB(w, h);
switch(rgb & 0x000000){
case 0x000000:
blocks.add(new Block(pos.xpos + w*32,pos.ypos + h*32));
break;
// case 0xFFFFFF:
// blocks.add(new Block(pos.xpos + w*32,pos.ypos + h*32));
// break;
}
}
}
}
}
and when i render with
g.drawImage(currChunkImg,(int)pos.xpos, (int)pos.ypos,64,64,null);
in the chunk class
it shows a black image