po galera, alguem pode ajudar a solucionar o erro de matriz que esta dando? E mto urgente. O metodo e o seguinte:
public void updateObjects(){ // método que coloca as novas trcks na animaçao
linha++;
boolean sts =true;
boolean tpf= false;
boolean tpt= true;
animImg traços[];
traços= new animImg[max];
for(coluna = 1; coluna <= 6; coluna++){
if(mtrzM[linha][coluna] == true){
int i = max-1;
switch(coluna){
case 1:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col1 , tpt);
j++;
break;
case 2:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col2 , tpt);
j++;
break;
case 3:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col3 , tpf);
j++;
break;
case 4:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col4 , tpt);
j++;
break;
case 5:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col5 , tpt);
j++;
break;
case 6:
traços[i] = new animImg();
traços[i].CrtTrck(prLin, col6 , tpf);
break;
default:
break;
}
}
for(j=max; j==0; j--){
if(traços[j].getSt()){
traços[j].setCord ((traços[j].getx() + pPFr) , traços[j].gety());
if(traços[j].getx()== ultLin){
traços[j] = null;
}
}
}
if(linha == mtrzM.length){
gon = false;
}
}
}
Void main:
public static void main(String args[]){
boolean mtrz[][] = {{ true,false,true,false,true,true },
{true,false,true,false,true,false},
{false,false,true,false,false,true}};
int nm=1;
long frs = 5;
BaqLoop b= new BaqLoop(mtrz , nm , frs);
}
Esta dando o erro :
Exception in thread “Thread-2” java.lang.ArrayIndexOutOfBoundsException: 6
at BaqLoop.updateObjects(BaqLoop.java:66)
at BaqLoop.run(BaqLoop.java:11)
at java.lang.Thread.run(Thread.java:595)