2D level building

Ok so I have a bunch of pipe objects (sprites) in my scene that I have arranged manually in the correct order in my scene. These pipes are rotated when the game starts and the idea is rotate the pipes back to their oiginal positions. When they match, you win… Basic stuff…

My question is, if I have 10, 20, 30 levels etc how do I build them? Do I have one scene per level or load in pipe locations (x, y) and types (some will be left bend, right bend, cross pipes etc) for each level?


It depends on many things. If your levels are simple and differs only by pipes arrangement, then you should use only one scene which loads pipes from … xml file for example. Then u just put pipe nodes in XML, one by one, with arguments like position_x, position_y, rotation, shape_id etc. Then u just make different pipe shapes as separate game objects, and while loading level from XML, for each node you instantiate game object mapped by shape_id, then u set position and rotation and voila! Level loaded.

If you dicide to use such solution, you will be able to build new levels very easly, with some tiled level builder app - if you treat separate pipe shape as separate tile (in level builder it may appear as square but in XML it can be saved as just ID number with additional params like position and rotation, color maybe etc …).