Spawning Object in "On Destroyed" spawns on another layout

Bugs will be moved here once resolved.

Post » Wed Aug 13, 2014 1:23 pm

Problem Description
I got objects that spawn other objects when they are destroyed. For example, explosion after grenade, monsters that spawn smaller monsters upon death, etc. I spawn these objects in "On Destroyed" event, and I see that when I change the layout, the objects spawned during "On Destroyed" will appear in the next layout.

Attach a Capx
https://www.mediafire.com/?htk7sn6if1vhduk

Description of Capx
The capx has a black box and a red box.

The black box got a drag and drop behavior. Left click to move it around.

Middle click on black box to destroy it, which will leave a red box behind. (using "On Destroyed" event, apparently)

Right click creates another black box.

Press R to restart layout. You will see that upon restart, red boxes will appear in all positions of where all the black boxes were.

Steps to Reproduce Bug
Just create objects during "On Destroyed" event and change layout, and you will see this bug.

Expected Result
Objects that are created in "On Destroyed" event should not appear in the next layout.

Affected Browsers
  • Chrome: YES
  • FireFox: YES

Operating System and Service Pack
Win7 64 bits

Construct 2 Version ID
r173 64bits

I used "On Destroyed" in various places: a big slime monster could spawn more smaller slime monsters upon death, and smaller slime monsters also spawn the liquid explosive upon death. The liquid explosive leaves trace of liquid upon destroyed. Everything is fine if the player killed everything and nothing invokes "On Destroyed" event upon layout changing, but if some objects are not killed, something will pop up in the next layout. That's bad.

One more thing: I also noticed that sometimes the object count becomes negative/incorrect in the game I am developing. During layout changing, the game stutters a bit, given there are hundreds of objects in the layout. And sometimes, the object count is incorrect.

I have been trying to reproduce the negative object count on a smaller scale capx, but I couldn't reproduce it. All these "On Destroyed" events in my project also have sound effects played during "On Destroyed" and they stutter quite a bit upon layout changing. I am not sure whether frame stuttering is related to negative object count or not. Yet I only see object count becoming incorrect upon layout changing (ie. restart layout) only. In fact, by simply restarting a layout in my project once or twice, I already see object count number decreasing upon restart. Sometimes I see it on the first restart, sometimes on the second, sometimes third.

I have also tried remove "included event sheets" that are related to these events of monsters, etc., and I see that the object count number is correct. But like I said, I couldn't reproduce this on a smaller scale yet. Still, could you please investigate what could go wrong here? Thank you.
Last edited by TwinBlazar on Wed Aug 13, 2014 1:53 pm, edited 1 time in total.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Wed Aug 13, 2014 1:37 pm

I have also looked around the forums and found a similar bug report for my second issue: negative-objectcount_t91148?&hilit=On+Destroyed+negative+objectcount . R0J0hound provided the capx: https://dl.dropboxusercontent.com/u/542 ... count.capx

I have tried this capx on my r173, and the "object count becomes negative" issue still hasn't been fixed.

This could also be related, as this capx also spawns object in "On Destroyed" event and also restarts layout as well.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Wed Aug 13, 2014 2:57 pm

Closing as won't fix: objects are destroyed at the end of the layout (when it is restarted or goes to a different layout), and so you are creating more new objects at the end of the layout. I think it's reasonable that these objects you created continue to exist. If you don't want them to exist, don't create any more objects after changing layout (set a global variable flag or some such).
Scirra Founder
B
397
S
236
G
88
Posts: 24,408
Reputation: 194,506

Post » Thu Aug 14, 2014 1:49 am

Hey, @Ashley, thank you for your suggestion. It does fixed this issue. Incorrect object count is also no longer an issue as well.

Thank you for your assistance as always. :)
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests