Easiest way to make multiple levels?

0 favourites
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • I have a game in which all the levels will be similar. The first layout is all I have made and has on it all of the objects needed for the game. What is the easiest way to duplicate all of the objects on this layout to another layout, keeping all of the layers correct?

    Also this method worries me significantly as after I want to make a change to a universal game object, and I have levels already made, I have to change it in EVERY layout?

    Basically, what is the best way to make multiple levels by editing level 1?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Place all objects in your layout on the same layer. Then click on the home tab. Then click on select all. Then right click on the layout and click copy. Open a new blank layout. Right click anywhere on the layout and select paste. All objects will maintain the same properties as the ones in the original layout.

    Another quick way is to simply make every object in the first layout global. Then create an instance variable for each object. Place each object at layer 0. Creat an event sheet that has compare instance variables for each object (i.e, if instance variable = 0 then set object to layer 0, if instance variable >/= 1 set object layer to 1) Then include that event sheet to the event sheet for each level. Make sure each level/layout has at least 2 layers (layer 0 and layer 1, the active layer) Then for each individual level's event sheet have add action as "on start of layout" then an event for each object you want on that level by either adding or subtracting 1 from its instance variable...in essence setting its visibility (layer 1) or hidden behind the scenes (layer 0).

  • The first method you stated is probably the way to go - apart from the problem that any updates to any objects will require a major hassle in updating the changes.

    The second method sounds inefficient and not really what I'm looking for. It would be incredibly hard to do - especially as I have over 60 objects at the moment.

    There must be a simple efficient way to do this. As worst case scenario I would have to update any changed object across all the levels however this is terribly inconvenient. Keep in mind that there will also be non-level layouts for menus.

  • I can guarantee that the second method, though it takes time to initally set up, is an extremely efficient method. I have 37 levels and 64 player-usable items set up with it in my game. Practically all of the objects are only on one layout and with this system I can easily create new layouts and with a few events and actions determine which objects are or are not visible on the new layout.

    It kind of functions as a CMS for my game.

    Here is an early capx showing my example.

    Since then I have set everything up so that the inventory, equip subscreen, background tile, etc... are all only present in the 2nd layout, are set as global objects and are included on each layout by setting their instance variables to 1 (moved to layer 1) just like how the inventiry items are.

    If I don't want an object visible on a particular layout then I set an action and event to move the object to layer 0 for only that layout. As you can see from the example it truly does function as a quasi-Content Management System for the sprites and objects throughout the whole game.

  • OK, I am game, however I will need a better explained way to do this in accordance with what I want. Your example does not work for me, I get an error about a behavior which I do not have.

    For my game, all objects should be working on all layouts (apart from the menu layouts) however there are minimal changes on each layout. I do not quite understand what you are saying however I am happy to create this instance variable for each object if I know exactly what I am doing.

    A problem it seems with your solution is that you can only use one layer in a layout. My layout currently has 3 (a HUD, a main layer, and a background.)

  • Do you have an example capx you can send me?

  • Think of the game 'Ghost shooter'. Logistically, mine is very similar (three layers, objects currently not in use outside the layout)

  • I'll whip up a tutorial and put it on here.

  • Excellent! thanks alot.

  • Here is the capx Here

    Will be posting the tutorial and examples soon.

  • It seems good, but that is a lot of work (it seems all objects have to be placed by code), and when I have 80 or so objects... And I only get one layer. Perhaps Ashley or Tom could let us know the way it was intended to work...

  • This is still bugging me... Since I will have many objects and relatively few levels (within the levels, not much is to be changed, just walls and the like) I suppose I am not too concerned about updating new/changed objects.

    A 'duplicate layout' option would be nice, I suppose...

  • There's a "hack" to duplicate layout.

    Save your project as a folder (or open your capx in a zip program like winzip or 7zip and extract the files to some folder).

    In the folder "Layouts" go and make a copy of the layout you wish to duplicate (ex "Layout 1.xml")

    Rename the copy (ex: "Layout 2.xml")

    In the file itself, change the name in between the <name></name> tags.

    (ex "<name>Layout 2</name>")

    Go back to the root folder and open your .caproj in the notepad.

    Look for the line:

    <layout-folder expanded="1">

    Right after you should have:

    <layout>Layout 1.xml</layout>

    Copy this line and paste it right after (with the same indentation). Rename to the name you gave to the layout copy earlier (ex: "Layout 2.xml")

    Save the .caproj, open it in C2, you should have a clone of the previous layout standing in your Layouts folder. This layout is currently aimed to use the same event sheet as the original layout.

    It's a bit hacky, so be sure to make backups of your projects before using it and use at your own risks ^^.

  • Hmm, seems fine I suppose. Funny how all the methods for simply making more levels seem so... convoluted...

    I tried your method and I got an error (layout name "layout 1" is being used by more than one layout).

  • I tried your method and I got an error (layout name "layout 1" is being used by more than one layout).

    The error is telling you what the problem is! You can't have two layouts with the same name. Make sure you edit the <name> tag of the second layout.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)