I am currently creating a 2d top down game. The tilemap of my game is divided into rooms. I have implemented the rooms as Rectangle objects.
Within each room there are both tiles and enemies. Enemies are implemented as Tile objects. For the game to work I need to find both the tiles and enemies and add them to the room where they belong.
It is easy for me to find the tiles which belong to the room as I know the coordinates of the room.
However, when it comes to enemies I need to loop through all enemy objects and add each which is within the bounds of my room.
It would be useful if I could have an objectgroup within an object.
With the added functionality I would be able to have an objectgroup named “rooms”. Within the “rooms” objectgroup all the rooms are stored as objects.
Within each room object there is an “enemies” objectgroup that stores all enemies within the room. This makes access of enemies that belong to the room much faster.
I hope you understand what I mean, if not, I can provide further explanation.