How do I create an object exactly on start of layout?

0 favourites
  • 7 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi to everyone!

    Is it possible to create an object (by name) ready to be shown exactly on start of the layout? When I use the action "On start of layout, create ObjectX", the object is created a "tick" after the layout is shown. I want the layout and the object to be shown together at the same time.

    Thank you very much!

  • When I use the action "On start of layout, create ObjectX", the object is created a "tick" after the layout is shown.

    That's the correct way to do it. It should appear immediately, not a tick later, when you do that. 'On start of layout' runs before the first frame is drawn.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley thank you for the response! Congratulations for the wonderful work you all do!

    Unfortunately it's not working for me.. There is a slight delay when the new object is created.

    If you have time, check a simple project that I made, in order to reproduce my problem: drive.google.com/open

  • It's because you are creating an object not placed on the layout. This means Construct's memory management assumes it is not used on that layout, but then you immediately create it, so it has to load its textures on-the-spot. It is created immediately, but it can't be drawn immediately because the textures are still loading.

    It's simple to solve this... just place the object on the layout instead of creating it on startup! Alternatively if you only sometimes need it, destroy it on start of layout if you don't need it, rather than creating it if you do need it.

  • The problem is that I don't want to place a specific object, but an object by name, defined by a variable. So I'm thinking these solutions:

    1. If it is possible, to show the next layout after the object is drawn.

    2. To make a global layer, create the object at this global layer and then change layout. But even if my layer is global, the object is being destroyed at the end of the layout.

    3. To place an object (without image) on the global layer and use "load image from url" in order to choose as image a url of another object.

  • Just place all objects the layout could use, on to that layout. Then destroy the ones you don't need on startup. That is how Construct's memory management is designed to work, and means anything you create will be visible immediately.

  • Thanks again Ashley! I did it the way you said. Keep up the good work

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