- Home /
Best approach for triangle tiles using Sprite Renderer for a 2D platformer
Hey everyone!
I'm currently making a 2D side scroller game, a la. Super Mario. To build the levels I use tiles and each tile is a game object with a sprite renderer attached to it. Walkable/intractable tiles have a box collider on them. All of the sprites are atm squares.
I want to add tiles that are shaped like triangles to my palette of tiles to choose from. I have been considering two options on how to do that:
1) Add one sprite for each triangle tile. One square sprite will therefore have 5 different sprites and variations, one square and 4 triangles (left slope up, left slope down, right slope up, right slope down). This solution will work. However, it will be a lot of extra work to add and maintain all the extra sprites. More sprites means that the application size will be larger AND there will be more atlas pages, resulting in more draw calls.
2) Using a mask in order to only show parts of my existing square sprites. Something along the lines of this: http://forum.unity3d.com/threads/released-sprite-mask-masking-system-for-unity-sprite.292453/ This solution would be easier to maintain after implementation and I would not need to worry about different variations of sprites. However, maybe the implementation will take a long time. Maybe there are some other draw backs like extra draw calls, performance, etc.
So what is the best approach considering performance and maintainability? Anyone had the same experience and faced the same design decision? Are there any alternative approaches?
I appreciate all the input I can get :)
Thanks!
No. The sprites are at the moment tiling seamlessly, which will break if i rotate them.