Creation of a tower with boxes

Update : i did it :smile: now I have a wall that can have a door, I’m very happy

2 Likes

But think I think the most hard to do is those little windows that the teacher call “Meurtirère” I tried my best but without nothing, is it possible like … to translate only the boxes that are before and after the middle to get a little hole like this ? :

void drawWall(int h, int l) {  
  for (int i = 0; i < l; i++) {
    for (int j = 0; j < h; j++) {
      pushMatrix();
      // Rotation de l'ensemble du mur
      rotateY(0); 
      // Ajouter un décalage à la position en x pour chaque deuxième rangée
      float xOffset = (j % 2 == 1) ? 5 : 0; // Décalage de 5 unités pour chaque deuxième rangée
      translate(i * 10 + xOffset , -j * 5 , 0);  // Ajouter un décalage à la position en x 
      fill(145, 145, 145); // Couleur de la boîte
      box(10, 5, 5);
      popMatrix();
    }
  }
}
1 Like

la meurtrière [ARCHIT.] is embrasure in English

Hello @Smail_OUABED,

I was able to achieve this with your code snippet and some experimenting:

image

Consider manipulating other variables to achieve outcomes.

Here I had a variable for bx:

if (conditions) //left side
        {
        bx = 5;
        translate(?);
        box(bx, 5, 5);
        }
      else if (conditions) // right side
        {
        ?
        }        
      else // rest of tower
        {
        ?
        }
      pop();  

It took some effort but was worth it!

:)

The English translation is different for subject and content for that word using Google Chrome! It did yield other terms of interest.

Other definitions:

:)