I was working on this function for creating a object called beast box which is a 40x40 square image that gets repeated 40 times. I'm using a loop and a array with a width of 10 and a height of 4 to achieve this.
When I call the function the first time I get the results I want. As seen in image 2.png
I want to destroy the boxes and recreate them each time the menu is opened. So I had the menu destroy the beast_box object when closed.
The problem is when I open the menu a second time the boxes are created and stacked on top of each other 40 times. (see 3.png All in the top left corner instead of being spaced out in neat rows. What am I doing wrong here?