오류 줄에는 주석이 있습니다. 도움을 고치는 방법을 모르겠습니다! 나는 그것이 출현 한 지점을 변경하려고 시도했으나 효과가 없었습니다.java.lang.ArrayIndexOutOfBoundsException : 11
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);
z 정의 방법은 무엇입니까? (또한 전체 예외를 게시 할 수 있습니다.) – FDinoff
20 개 미만의 요소가있는 z에 관한 것입니다. 더 정확하게는 10입니다. 그런 색인이 없기 때문에 11시에 사망합니다. – Alfabravo