What to do with "unused objects at start" on the layout?

0 favourites
  • 11 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello,

    I've seen that it is common practice to place objects which will be used later (aka "they will be spawned dynamically") outside the Layout.

    This is somewhat weird to me... Objects with bullet behaviour are flying off screen as soon as the layout starts etc, so you have to place them at the "correct" border of the layout so they not come into the players view during the start while they're flying off.. or place them on a "scrap layout" altogether.

    Is this really the "normal" way of handling the "unused" objects? Or is there a better one?

  • Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.

  • Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.

    Okay, that will work.. quite a "brutal" method and somehow rough around the edges, I would have guessed that Construct has a method to handle objects which are needed later on in the game a more elegant way, but doesn't seem so.

    Thanks for your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Destroy them on start of layout then create them when you need them. If they are outside the layout but then destroyed then they are loaded in memory and any lag is avoided.

    >

    Okay, that will work.. quite a "brutal" method and somehow rough around the edges, I would have guessed that Construct has a method to handle objects which are needed later on in the game a more elegant way, but doesn't seem so.

    Thanks for your help!

    you can destroy them or use their settings to set them disabled.

    If it is a bullet I destroy it and create when needed. For buttons and other objects I use disabled and enable as needed. I set all my buttons on the layout and make them visible and enabled as needed.

  • you can destroy them or use their settings to set them disabled.

    If it is a bullet I destroy it and create when needed. For buttons and other objects I use disabled and enable as needed. I set all my buttons on the layout and make them visible and enabled as needed.

    Yeah, I know that there are some objects which can be disabled via the settings.. I do that already, my problem was specific to bullets, particles etc. which have to exist at the start but can't be disabled fully (well, you could like setting the speed to zero etc. etc. but it's not THE solution for me either).

  • Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.

  • Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.

    Yeah, as I said in my first post, I usually already do this, my "scrap layout"..

    Still not elegant in my eyes, and occasionally I started this scrap layout when I click the "Run Layout" Button...

  • > Use a "assets" layout that you never go to on runtime to only place all your objects. That's what we usually do on our projects and it works and keep your game layouts clean.

    >

    Yeah, as I said in my first post, I usually already do this, my "scrap layout"..

    Still not elegant in my eyes, and occasionally I started this scrap layout when I click the "Run Layout" Button...

    It's a good practice though

  • It's a good practice though

    Who am I to ignore good practice? I'll keep this in mind, thanks!

  • It makes it easier at least for me to keep objects I may want to copy or clone as I progress on the game on the original layout as dragging them from the sprite list resets sizes. After your game is done you can clean it up and use a separate layout but I don't want two layouts with the same sprites while designing because the settings may not get changed in both sprites. JMO.

  • Hello,

    I've seen that it is common practice to place objects which will be used later (aka "they will be spawned dynamically") outside the Layout.

    This is somewhat weird to me... Objects with bullet behaviour are flying off screen as soon as the layout starts etc, so you have to place them at the "correct" border of the layout so they not come into the players view during the start while they're flying off.. or place them on a "scrap layout" altogether.

    Is this really the "normal" way of handling the "unused" objects? Or is there a better one?

    You can add a "Destroy outside layout" behaviour on the objects that you want destroyed and that saves you some lines of code.

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