Hi guys!
In my first project, I have a symmetric arena with “wall blocks” on both sides (and other similar objects but I focus on wall blocks here to make it clearer):
Same wall blocks on the right as on the left: same sprites & collision shapes, but flipped.
=> Technically it’s ok, as explained by @Britzl here:
In terms of collection structure, my first (super naive) idea was to duplicate the main game object “goal_left” (on the left - containing the wall blocks - I mentioned them in particular because they’ll be the only “physical” game object with a collision shape, the others are just cosmetic stuff) to create “goal_right”.
Then I decided to flip the “wall blocks” sprite by using a one-frame flipped animation directly in the atlas (as recommended by Britzl) . It worked as intended, but since all my “wall block” game object instances were sharing the same unique sprite… when flipping the wall blocks on the right, I was also flipping the wall blocks on the left (which makes perfect sense, I know at this moment I felt a bit retarded).
So I thought that maybe I could detect in runtime whether a block is on the left/right side (based on its position), and flip the sprites/collision shapes when the game starts… same for the script, they could share it but some conditions would define different behaviors (ex: the walls blocks are pushed back when a ball / bullet bounces on it)… but… fundamentally, isn’t there a less “complicated” / more elegant/smart/clean way to do it?
How would you structure & organize this collection/game objects to make sure that:
1/ you can share sprites/scripts etc. between left/right blocks?
2/ if you add game objects in the “goal_left” (main object), the changes are also applied to “goal_right” (but maybe “duplicating” the main object is not the solution at all … Would you have done it?)
Please let me know