I was trying to generate the background of my world in code (a background made of dirt with some stones) and I got some crashed pixels
these crashed pixels are white at the start and then just keep the color of the last actor at that position
Does anyone know what causes this ? (alpha data ?)
EDIT : I added an b.fill() after the b.setColor and the crashed pixels disappeared so I guess it was alpha
but I still don't really understand why this bug accours doesn't Greenfoot check for this ? if not I found you a bug (I'm using an older version so it may be fixed already)
I don't really think you need the code but I will post a part of it anyway
these crashed pixels are white at the start and then just keep the color of the last actor at that position
Does anyone know what causes this ? (alpha data ?)
EDIT : I added an b.fill() after the b.setColor and the crashed pixels disappeared so I guess it was alpha
but I still don't really understand why this bug accours doesn't Greenfoot check for this ? if not I found you a bug (I'm using an older version so it may be fixed already)
I don't really think you need the code but I will post a part of it anyway
protected void generateBackground() {
GreenfootImage b = new GreenfootImage(getWidth()/7,getHeight()/7);
//make the ground brown
b.setColor(new Color(57,37,23));
//randomise the ground
int groundPatches = Greenfoot.getRandomNumber(b.getWidth()*b.getHeight()/21);
for(int i = 0; i < groundPatches; i++) {
addPatch(b, 21, new Color(57,37,23), 7, 3, 5);
}
//add random stones
//Color c = new Color(70+rNum(-7,7),70+rNum(-7,7),70+rNum(-7,7));
int stones = Greenfoot.getRandomNumber(b.getWidth()*b.getHeight()/(21*5));
for(int i = 0; i < stones; i++) {
addPatch(b, 21, new Color(70,70,70), 7, 7, 7);
}
b.scale(getWidth(),getHeight());
setBackground(b);
}

