[r98] Duplicating layout duplicates global objects

0 favourites
  • 5 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hey hey. Not sure if this can really be called a bug, its more of an inconvenient behavior.

    So I've been playing around with a bunch of global arrays to hold information for my game. I've finished the level prototype and I am ready to begin creating new levels. However, when duplicating the prototype level, the global arrays are also duplicated. Unfortunately this is a bit game-breaking for me as I use a lot of 'For Each Element' loops. Their doesn't seem to be a convenient way to delete the arrays from the layout - and I only ever need one for the entire project.

    Here's an example where I:

    1. Created an array
    2. Duplicated the layout

    dl.dropbox.com/u/1378330/ArrayExample.capx

    Is there an easy way to delete global objects from a layout? Or could we possibly get a dialogue that asks us if we want to duplicate global objects when duplicating a layout?

  • In the future, you might start your projects by creating an "object bank", which is simply a layout that isn't really used for anything except to hold your global objects and to keep a copy of objects you want to spawn/create during the game (to get around the limitation that there must be at least one copy existing somewhere.) So your audio, arrays, etc. would all go here as well as an instance of every object that doesn't appear at the start on your layout.

    All very well and good, but you need to solve your current situation. Here's how I'd do it:

    1) Backup your game, and, working with a copy,

    2) create a new empty layout with all of the layers in your existing prototype layout, and name it Template

    3) lock all of the layers in your prototype layout and one layer at a time unlock the layer, select all of the objects on the layer and paste them in the corresponding layer on the Template layout.

    4) When all of the objects are correctly in place on the template layout, set its event sheet and test it.

    5) If testing goes well, use the Template layout as the starting point for your new levels. You can keep the original prototype level as it is, or delete all of the unnecessary objects from it and rename it "Object Bank".

    6) When you finish your game, you may want to delete the Template layout, or rename it and use it as your last level.

    Hope that helps!

  • cow_trix - I do think this is a bug so I've changed it in the next build to not duplicate invisible instances.

    You can remove invisible instances by hacking the project XML. The invisible instances are in the layout's XML file under a tag called 'nonworld-instances'.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Should be fixed in r99, can you confirm?

  • Hi Ash. It worked - however, because I already had multiple instances created from duplicating the layout, deleting the duplicated layouts did not delete the duplicate global objects, so those I had to delete manually. However, from this point on it should all work fine. Thanks!

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