Best practice for triggering global items / enemies

0 favourites
  • 8 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hello, this isn't so much a "how do I" but more a request for the most professional method.

    If I have a common object, say a treasure chest that appears in multiple levels, should I insert this into an existing player layout, so I can INCLUDE it, or should I create a new layout for each seperate item/enemy etc. and include it seperately, then trigger the creation of the object via "trigger tiles" that I can place around the map?

    Is this method also viable for enemies etc, if not, what would the best and most organized method be?

    Thanks.

  • It's not clear what you are asking but if it's what I think you are asking then I will say you can create one layout and put all of your objects into it, it won't ever appear in game but stores the initial data/stats of objects. You need at least one instance of each object to exist in the game for reference.

  • I usually create a layout, without event sheet, called Assets in which I put all the assets that will be dynamically added to any of the layouts later.

  • Thanks for the advice, that's pretty much what I was asking about, however, if I have a layout for all the assets, for all levels, that contains a lot of stuff I won't use per stage - for example if I only use 2 enemies in a level from an "assets" event sheet that contains say another 20 enemy animations etc that aren't used, is that inefficient?

    Or is using a seperate event sheet containing one enemy each and including only the event sheets I need more efficient?

  • I think you're mixing things up. Layouts are one thing, Event sheets are another. In layout you'll have objects (sprites, texts, etc), while in event sheets you'll have code (events, actions, conditions, etc).

    The assets layout is there just to guarantee that anything you'll need to create dynamically is available, since Construct requires that at least one instance of an object exists in order to create it dynamically (by using the "Create object" or "Spawn another object" events). This layout has no event sheet associated to it. I'm not sure this is the most efficient way and I can't tell if all objects are loaded or only the ones you create (I think it's the second option).

    You can also have separate event sheets with code you'll reuse and just include then at the layouts for each level. But I'm not sure having enemy specific event sheets that you include only in layouts that have those enemies is worth it. In my understanding, if you have code that is never triggered it just won't do a thing. Of course it WILL be loaded, but, again, I don't believe this will affect significantly the loading times and cpu use.

    Maybe Ashley could help us all on this...

  • It's efficient as long as you are not going to this layout during runtime. The objects in the other assets layout are never loaded and don't affect memory usage. Only the images in the current layout are loaded. You can put every image you are going to use in the game into one unused layout, it won't affect the game or use memory. If you are bothered about temporary freezing or a stutter when it tries to load in an image that does not exist in the layout then you can have it in the current layout but destroy it at the start of the game, this allows it to be preloaded.

  • It's efficient as long as you are not going to this layout during runtime. The objects in the other assets layout are never loaded and don't affect memory usage. Only the images in the current layout are loaded. You can put every image you are going to use in the game into one unused layout, it won't affect the game or use memory. If you are bothered about temporary freezing or a stutter when it tries to load in an image that does not exist in the layout then you can have it in the current layout but destroy it at the start of the game, this allows it to be preloaded.

    That's what I thought... Thanks for confirming!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the advice - highly appreciated.

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