How do I Stop Multiple Spawn on Restart Layout?

Get help using Construct 2

Post » Sat Aug 09, 2014 8:38 pm

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.
You do not have the required permissions to view the files attached to this post.
B
5
S
1
Posts: 38
Reputation: 839

Post » Sat Aug 09, 2014 8:52 pm

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.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sat Aug 09, 2014 9:01 pm

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 :)
You do not have the required permissions to view the files attached to this post.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Sat Aug 09, 2014 9:16 pm

@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. :)
B
5
S
1
Posts: 38
Reputation: 839

Post » Sat Aug 09, 2014 9:21 pm

No probs.
Glad I could help.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 38 guests