(SOLVED) Objects of the same class are getting changed to the same object
Posted: Sun Feb 06, 2022 7:06 pm
Hi there!
So, I have function call to construct a building on a selected tile. Each tile has an entity variable, and an entity can be initialized as a building (as a subclass of entity). However, when I build a building on a selected tile, all previous buildings turn to the building type I choose.
Say we have two houses (first picture), then place a church (second picture). The houses get overwritten!
https://love2d.org/imgmirrur/3AkfGD5.html
It won't let you overwrite houses if you try to build in a spot that already has a building, so I guess that's good. In addition, tiles that have been previously selected - but not built on - are not affected.
I have to assume I'm doing something wrong with middleclass: https://github.com/kikito/middleclass.
So, I have function call to construct a building on a selected tile. Each tile has an entity variable, and an entity can be initialized as a building (as a subclass of entity). However, when I build a building on a selected tile, all previous buildings turn to the building type I choose.
Say we have two houses (first picture), then place a church (second picture). The houses get overwritten!
https://love2d.org/imgmirrur/3AkfGD5.html
It won't let you overwrite houses if you try to build in a spot that already has a building, so I guess that's good. In addition, tiles that have been previously selected - but not built on - are not affected.
I have to assume I'm doing something wrong with middleclass: https://github.com/kikito/middleclass.