[Solved] How do I dispose sprites?

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I have a sprite that draws a grid.
The grid has a bunch of sprites contained inside.

1597550953942.png

Code:
var gridSprite = new Sprite_Grid();
// add weapon sprites to grid
SceneManager._scene._spriteset.addChild(gridSprite);

gridSprite.parent.removeChild(gridSprite);
gridSprite = null;
console.log(gridSprite);
The grid gets displayed and all the other sprites...but now I want to dispose of the grid.
Doesn't seem to work though.

Do I need to dispose ALL children sprites as well?
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Nevermind, it was working actually. It's just that I was redrawing the sprites somewhere else and I didn't realize.

So it was disposing everything, and then re-drawing them immediately.
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,204
First Language
Binary
Primarily Uses
RMMZ
I personally have always tried to call 'destroy()' on sprite objects I create before the scene.terminate function runs, eg:
1597555525422.png

Something Mv never really seemed to do, but just made sense to me coming from ace :D

MZ does seem to do a better job at automatically handling that though.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I personally have always tried to call 'destroy()' on sprite objects I create before the scene.terminate function runs, eg:
View attachment 155419

Something Mv never really seemed to do, but just made sense to me coming from ace :D

MZ does seem to do a better job at automatically handling that though.
What does MZ do?
 

??????

Diabolical Codemaster
Veteran
Joined
May 11, 2012
Messages
6,513
Reaction score
3,204
First Language
Binary
Primarily Uses
RMMZ
mz:
1597557393021.png

Compared to mv (which does absolutely nothing, which calls the default destroy from container class, which doesnt auto destroy children/textures it seems):
1597557441319.png
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top