Destroy objects at start of layout without triggering destroy triggers?

  • How are you guys destroying objects at the beginning of the layout? IF every object needs to be in the layout at the start for them to be called in game, how are you guys destroying them without triggering future destroy triggers?

    This is an example

    At layout load > destroy OBJECT 1

    ...

    ...

    ...

    ...

    On OBJECT 1 destroyed > create OBJECT 2

    How can I change this to not trigger the destroy event until later in the game.

    I know I can probably use a boolean to make it work, but that seems inefficient.

  • You don't usually have Bools that tell you the game has started?

  • Not sure what you mean?

    Does everyone have a bool called game start?

    and add that condition to every single condition containing a destroy check?

  • You could put the rest of the event sheet's code, aside from that in the on start event (or just the code with the on destroyed conditions) in a disabled group and then enable the group at the end of on start.

  • You might need to put a Wait 0.1 seconds before enabling the group to avoid the on destroyed conditions still triggering in the same tick.

  • IIRC you no longer need to have a default instance in the layout editor at all anymore.

    Before, you could make a separate layout that wasn't used with all your sprite objects to set defaults, they just need to be on one layout in the project, not every layout in which it was used.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • IIRC you no longer need to have a default instance in the layout editor at all anymore.

    Before, you could make a separate layout that wasn't used with all your sprite objects to set defaults, they just need to be on one layout in the project, not every layout in which it was used.

    That is amazing. I think this will help. Thanks!

  • another way is to just make a bool called NotFirstTime = false.

    then at the bottom of your sheet set it to true.

    then do OnCreated AND NotFirstTime or OnDestroyed AND NotFirstTime

  • another way is to just make a bool called NotFirstTime = false.

    then at the bottom of your sheet set it to true.

    then do OnCreated AND NotFirstTime or OnDestroyed AND NotFirstTime

    This is something i do now but was seeing if there was a better cleaner way to do it.

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