why do objects have to be on layout

  • I use createobject to change the appearance on the screen based on certain conditions(display buttons etc.) but the object must be present in the layout, making it quite cluttered as i have a lot of objects.

    why is it that the object must be present in layout?

  • Well they need to be on the layout at some point or you wouldnt see them. The other option is to create the objects at the start of the layout and place them where they need to be using code.

  • kaiko

    You might try to put sprites on an unused layout.

  • Bear in mind that the objects don't need to be present on the layout on which you intend to create them. They just need to be somewhere. I guess the thinking is that objects aren't assigned their basic properties like opacity, size, etc. until they've been placed. Not sure why that is, exactly - I'd think that an object could be just as easily parked in the project folder with default properties, but whatevs, that's just how it works.

    Personally, I like to create a parking lot layout in which I store all my objects that are waiting to be created. The only time I'll have an object on standby in the actual game layout is if it's a large image or one with a lot of animations/frames, which would cause a slight lag as its created if that would've been the first time it is to appear on the layout.

  • The other option is to create the objects at the start of the layout and place them where they need to be using code.

    this is what i want to do but construct gives an error message if object isn't present in layout.

  • > The other option is to create the objects at the start of the layout and place them where they need to be using code.

    >

    this is what i want to do but construct gives an error message if object isn't present in layout.

    Correct. They have to be on some layout to be included with the game information/export. Just have a dummy layout and throw all your objects on there to meet that requirement.

  • Holy moly! I've always wondered this and now it makes complete sense to just create a dummy layout for just the objects/images. This is one of those "this changes everything" moments for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Agreed punkineo - this helps me wrap my head around layouts versus layers.

    I see it says in the manual you can have as many layouts /scenes as you want but using a layout as a storage dump for objects is really cool.

  • I always have a layout in each game called "Sandbox" that I throw one copy of all objects into. This makes it so much cleaner not to have to have objects off screen on all my other layouts prior to creating the instances of them in events.

  • The dummy layout thing is a very good idea.

    But is there a way to modify the z-order if you place all sprites on a dummy layout instead of the correct one?

  • This was a great question with fantastic answers!! When I saw the dummy layout option I was like 'DUUUUH' something so much better. Will add it to my development practice!!

  • Allchix You can use events to change the z-order when you create the objects.

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