1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| public void deplacementOuestEst(int tableau[][]){
for(int i=0;i<tableau.length;i++){
for(int j=0;j<tableau[i].length-1;j++){
if(tableau[i][j]==1 && tableau[i][j+1]==0 ) {
// tempsTotalPietonE+=0.5;
tableau[i][j]=0;
tableau[i][j+1]=1;
break;
}
}
}
}
public void deplacementEstOuest(int tableau[][]){
for(int i=0;i<tableau.length;i++){
for(int j=0;j<tableau[i].length;j++){
if(tableau[i][j]==2 && tableau[i][j-1]==0 && j>1){
tempsTotalPietonE+=0.5;
tableau[i][j]=0;
tableau[i][j-1]=2;
break;
}
}
}
}
public void creerDeplacement(){
timer.scheduleAtFixedRate(new TimerTask(){
public void run(){
System.out.println("deplaced");
grillePieton.colorierCases(tableauP);
deplacementOuestEst(tableauP);
deplacementEstOuest(tableauP);
}
}, 0, 1000 );
} |
Partager