Request: Destroy all sprites action

Discussion and feedback on Construct 2

Post » Mon Mar 18, 2013 4:55 am

I think it would be handy to have a "destroy all sprites/objects" action. This could be used before changing level because many times there will be a few sprites that remain on screen when changing level (for instance I usually see bullets continue flying across the screen after changing level.)
B
139
S
67
G
17
Posts: 1,767
Reputation: 20,070

Post » Mon Mar 18, 2013 6:09 am

I second this idea.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,214

Post » Mon Mar 18, 2013 7:17 am

When the layout is changed all objects that are not global are destroyed.

@alspal if your bullets are not set to be global then I'd say its a bug that they are not destroyed on a layout change.

The only point where I think it may be useful to destroy everything is at a layout change, but you can do that now by making all the objects not global.
B
85
S
27
G
77
Posts: 5,000
Reputation: 53,734

Post » Mon Mar 18, 2013 7:19 am

I am assuming that your levels are on the same layout. A common practice is each level is a layout. As R0J0hound said, switching layouts destroys all non global objects...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,538

Post » Mon Mar 18, 2013 8:38 am

I don't think I use global on anything. I guess it's a bug then, it seems like the persistance of sprites happens when they've been recently created before the layout change but I'm not sure. Seeing that I can't replicate or figure out why it happens that's why I suggest adding this destroy feature, since Ashley usually requires specific directions for encountering bugs.
B
139
S
67
G
17
Posts: 1,767
Reputation: 20,070

Post » Mon Mar 18, 2013 1:22 pm

The engine definitely does destroy all non-global objects when switching layout, so I would say the most likely cause is you accidentally made some objects global.

Still, you can already do a 'destroy all objects' type event by putting a 'destroy' action under a 'pick all instances' event.
Scirra Founder
B
373
S
218
G
83
Posts: 23,434
Reputation: 185,808

Post » Wed Nov 05, 2014 8:47 pm

How does one control the scope of procedurally generated sprites? Do they adopt the properties of the pre-existing mandatory sprite?
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
21
S
6
G
1
Posts: 1,295
Reputation: 4,559

Post » Wed Nov 05, 2014 11:36 pm

I usually put all my destroyable object in a family and destroy that family on start of layout.
Image
B
65
S
26
G
12
Posts: 506
Reputation: 11,914

Post » Thu Nov 06, 2014 12:40 am

This would be useful for those dynamically loading levels via external files. You could use families but this would be a little easier I suppose.
Image
B
231
S
27
G
13
Posts: 1,782
Reputation: 18,195

Post » Thu Nov 06, 2014 12:40 am

Ashley wrote:The engine definitely does destroy all non-global objects when switching layout, so I would say the most likely cause is you accidentally made some objects global.

Still, you can already do a 'destroy all objects' type event by putting a 'destroy' action under a 'pick all instances' event.


I noticed it sometimes doesn't destroy particles already in flight, ie. one-shot spray and rarely, sprites with a short fade out. Not sure why but i never set global for any object.
B
66
S
24
G
19
Posts: 1,749
Reputation: 17,484

Next

Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, The Mnk and 8 guests