How do I Spawn an Object in a Different Layout

0 favourites
  • 5 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hello all.

    I've looked around but can't really seem to find anything relevant to what I need to know. For my layouts, each one represents a different level that the player can have objects on. The objects spawn normally up to a certain point on the first level, but I'm at the point where I need to have a new object being spawned on the second level, being created by actions on the first level. Any idea how to do that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On layout start -> Spawn X ?

  • You can't technically spawn something in a different layout because only one layout is really active at a time.

    One way you could do it is have global variables. This would only be efficient if you are tracking a few.

    spawn1 = 0

    If something happens in this layout spawn1 = 1

    On start of layout & spawn1 = 1 THEN spawn

    There is also Global setting in the instance property:

    [quote:100s9zr3]Global

    By default, all instances are destroyed when the layout ends (e.g. when going to the next layout). If Global is Yes, none of the instances of this object type will be destroyed when switching layouts.

    Maybe you could spawn in this layout, set to be inactive and hidden, then have it be global to carry over to next layout, then activate it. I haven't used this though so not sure if it works that way

    There is also the persist behavior. Don't believe this would help if spawning an object in a different layout but would help if wanting an object to stay the same when coming back to a layout.

    https://www.scirra.com/manual/161/persist

    Hope some of that is helpful

  • Worked like a charm. Thank you very much.

  • Which solution worked like a charm?

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