How do I Stop Multiple Spawn on Restart Layout?

0 favourites
  • 5 posts
From the Asset Store
Be quick and choose the right answer for the shown equation.
  • Hi!

    This one bug has me tearing my hair out! So here is the problem:

    I have an object (Cheese) that spawns at the start of the layout. If the character collects it, another one spawns at a random location. Till now, all well and good. Now, if the character dies, and the player selects to restart the game, instead of one instance of the Cheese spawning, TWO Cheese spawn. Now, if the character dies again, and the player selects to restart again, THREE Cheese spawn instead of single one. I have no clue what is wrong. I tried all I could, and it still occurs. Am attaching a screenshot of my Event Sheet.

    Note: Both the character and the object (Cheese) have Destroy Outside Layout behaviour.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is the on destroyed event the only thing creating more cheese?

    When is the cheese fading?

    a capx always helps. there are many things that can't be seen on an event sheet.

  • When you are switching layouts from A to B, all objects on layout A are destroyed.

    "Restart layout" or "go to layout" is like switching.

    So basically what is happening (which I think is a bug) is when you restarting layout, all objects are destroyed. And event Cheese: On destroyed is firing up and creates new object.

    Image below will fix your issue

    Edit:

    I said "will fix"... it should fix it, but can't be sure 100% because i don't know what your other events looks like

  • shinkan: Thanks! Adding Wait before creating again solved the bug. Thank you thank you thank you thank you.

    spacedoubt: Thanks for taking the time to look into it and reply. Shinkan's edit fixed it.

  • No probs.

    Glad I could help.

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