错误行对它们有注释。我不知道如何解决它帮助!我尝试改变它产生的位置,但没有奏效。
if(z[image].getColorAt(x,y).equals(Color.white))
和
addObject(new Char(0,0),80,360);
细节:
public Char(int up,int wep){
setImage(buffer);
upgrade=up;
weapon=wep;
for(image=0;image<20;image++){
for(int x=0;x<28;x++){
for(int y=0;y<24;y++){
if(z[image].getColorAt(x,y).equals(Color.white)) // this is part of the error)
z[image].setColorAt(x,y,alpha);
}
}
}
}
addObject(new control(1),300,200);
setPaintOrder(control.class , door.class,overlay.class,projectile.class,elevator.class,sword.class,upgrade.class,bat.class,fall.class,Tank.class,Enemy.class,bullet.class,platform.class,Char.class,lever.class);
setActOrder(elevator.class,Char.class);
addObject(new Char(0,0),80,360); // this line is part of the error
setBackground("Back1.png");
map = new GreenfootImage("map1.png");
addObject(new overlay(),300,200);