vendredi 21 mai 2021

maze




 
void generateWall() {
// remove the clones walls
for (int i = 0; i < g_sizex-1; i++)
for (int j = 0; j < g_sizey-1; j++) {
if(cell[i][j].wall[2] && cell[i][j+1].wall[3]) cell[i][j+1].wall[3]=false;
if(cell[i][j].wall[1] && cell[i+1][j].wall[0]) cell[i+1][j].wall[0]=false;
}
// store the walls into the Arraylist
for (int i = 0; i < g_sizex; i++)
for (int j = 0; j < g_sizey; j++) {
if(cell[i][j].wall[0]) wl.add(new wall(j*c_sizex-width/2, i*c_sizey-height/2, j*c_sizex-width/2, (i+1)* c_sizey-height/2));
if(cell[i][j].wall[1]) wl.add(new wall(j*c_sizex-width/2, (i+1)*c_sizey-height/2, (j+1)*c_sizex-width/2, (i+1)*c_sizey-height/2));
if(cell[i][j].wall[2]) wl.add(new wall((j+1)*c_sizex-width/2, (i+1)*c_sizey-height/2, (j+1)*c_sizex-width/2, i*c_sizey-height/2));
if(cell[i][j].wall[3]) wl.add(new wall((j+1)*c_sizex-width/2, i*c_sizey-height/2, j*c_sizex-width/2, i*c_sizey-height/2));
}
}

Aucun commentaire:

Enregistrer un commentaire

Remarque : Seul un membre de ce blog est autorisé à enregistrer un commentaire.