View Full Version : hitTest removing the MC?
sarumitai
05-31-2007, 07:25 AM
If I were to have a game where the character was walking around and collecting gold coins, is there a better way to make the collected coins disappear other than dropping its alpha down or shooting it off the stage?
I thought about removeMC, but they weren't duplicated or added that way so I don't think I can remove them that way.
Thanks
droid1618
05-31-2007, 08:06 AM
Maybe you can use goldcoin._visible=false ?
sarumitai
05-31-2007, 01:48 PM
That's what I did first, and it works, but it's still on the stage.
I'm not actually doing gold coins now, I am making a mixture of a practice game for the future RPG and making a game for teaching my kids English. When it loads it randomly scatters MCs (with letters inside) around the stage and kids have to move another MC around and touch them in order. Once they are touched I want them out of the way, but _visible = false just hides them.
Maybe that's the only way though.
No, you were right with your first instinct, you should remove them all together. Anything you leave on the stage is eating up some level of resources, which in a game is usually not a great idea. Visible/alpha does nothing to free up memory, it is purely visual.
The issue with removing clips is not whether or not they were duplicated, it is simply the depth that they are stored at. They go hand in hand because clips created at runtime tend to have a depth higher then 0, while clips placed at design time are created (starting) at the default depth.
(-16,384 I believe...)
All you have to do is swap to a higher depth then 0 before you remove, just be sure you dont swap to a depth that contains any other objects, or you will lose them too.
I personally always use one static depth (my birthday actually), so then I know I will not ever use that as an actual depth for content.
this.myMc.swapDepths(2007);
this.myMc.removeMovieClip();
//OR
this.myMc.swapDepths(2007);
this.myMc.unloadMovie()
sarumitai
06-01-2007, 04:51 AM
Answered it perfectly.
This is why I use AS.org for questions.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.