# Creation of a tower with boxes

**URL:** <https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [November 17, 2023, 7:42am UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232 "2023-11-17T07:42:42Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Smail\_OUABED](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Smail\_OUABED](https://discourse.processing.org/u/Smail_OUABED)\
**Post date:** [November 24, 2023, 9:26pm UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232/21 "2023-11-24T21:26:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Smail\_OUABED](https://avatars.discourse-cdn.com/v4/letter/s/5f9b8f/32.png) [@Smail\_OUABED](https://discourse.processing.org/u/Smail_OUABED)\
**Post date:** [November 24, 2023, 9:37pm UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232/22 "2023-11-24T21:37:05Z")

</div>

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 ? :

 ![Capture](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/8/9/89939d999e5e888f3b522ec7d1124893b501e1c6.png)

```auto
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();
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 25, 2023, 12:31pm UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232/23 "2023-11-25T12:31:15Z")

</div>

> [@Smail\_OUABED](#):
>
> Meurtirère

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

> **[Embrasure](https://en.wikipedia.org/wiki/Embrasure)**
>
> An embrasure (or crenel or crenelle; sometimes called gunhole in the domain of gunpowder-era architecture) is the opening in a battlement between two raised solid portions (merlons). Alternatively, an embrasure can be a space hollowed out throughout the thickness of a wall by the establishment of a bay. This term designates the internal part of this space, relative to the closing device, door or window. In fortification this refers to the outward splay of a window or of an arrowslit on the insid...

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 26, 2023, 1:05pm UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232/24 "2023-11-26T13:05:25Z")

</div>

Hello @Smail_OUABED,

I was able to achieve this with _your code snippet_ and some experimenting:

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/1/c/1c2c4b0bfd88a0fc9384ff6bbda6865ca1b48ee2.png)

Consider manipulating other variables to achieve outcomes.

Here I had a variable for _bx_:

```auto
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!

`:)`

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [November 26, 2023, 1:15pm UTC](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232/25 "2023-11-26T13:15:34Z")

</div>

> [@Smail\_OUABED](#):
>
> those little windows that the teacher call “Meurtirère”

> **[Meurtrière](https://fr.wikipedia.org/wiki/Meurtri%C3%A8re)**
>
> Pour le film de Patrick Grandperret, voir Meurtrières (film).
> Une meurtrière (de l’adjectif « meurtrier ») est un terme générique qui désigne une ouverture pratiquée dans une muraille pour permettre l'observation et l'envoi de projectiles. Cette embrasure, typique de l'architecture militaire médiévale, contribuait au développement de la défense active. Ce terme est progressivement abandonné en raison de son imprécision, au profit de ceux plus précis d’archère, arbalétrière, archère-canonnière.

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

Other definitions:

- [Arrowslit - Wikipedia](https://en.wikipedia.org/wiki/Arrowslit)
- [Embrasure - Wikipedia](https://en.wikipedia.org/wiki/Embrasure) Shared in previous post
- [https://www.haggardhawks.com/post/meurtrière](https://www.haggardhawks.com/post/meurtri%C3%A8re)

`:)`

[Previous page](https://discourse.processing.org/t/creation-of-a-tower-with-boxes/43232.md?page=1)
