> delete something that garbage collection would take over after the
> function exits. Someone correct me if I'm wrong.
Yes, you can do that with Flash methods like onEnterFrame, but not objects.
Notice, just because you delete an object like that and it doesn't respond
to methods that cause a t
Mark Burvill wrote:
public function die():Void {
trace ("deleting");
removeMovieClip (baddie_mc);
delete this;
trace ("Am i still alive?");
}
The movieclip is successfully removed, but I would expect the second
trace "Am I still alive" NOT to appear as the obj
If you're going to constantly be creating enemies, you might want to simple
do a check of existing enemies and if an enemy is dead, delete it when you
create one.
The important thing to note is that an enemy cannot call the destroyEnemy()
method of its manager because then it's still the same th
maybe I am just thinking out loud (and my mind is a tricky one)
but, don't you delete an object's instances and not directly the class
itself (how could it delete itself ?) ?
like:
var baddieInstance = new Baddie();
... later ...
baddieInstance.die(); // internal deletion process (like
remo
Nice one - thanks Andreas. :o)
Andreas Rønning wrote:
Mark Burvill wrote:
Hi all,
I've just started transitioning to AS2 (so go easy on me), and have a
question about a game I'm building...
I have a "Baddie" object which handles a baddie on the screen, and
when one gets killed, and has fi
Legal or not, it's very unwise to let an object kill itself. Letting
an object commit suicide would leave the rest of a program in a lurch
as it wouldn't really know where to go from there. You haven't
officially returned back to the caller at that point. You are better
off sending out an e
Mark Burvill wrote:
Hi all,
I've just started transitioning to AS2 (so go easy on me), and have a
question about a game I'm building...
I have a "Baddie" object which handles a baddie on the screen, and
when one gets killed, and has finished it's death animation, I'm
running a method within
Hi all,
I've just started transitioning to AS2 (so go easy on me), and have a
question about a game I'm building...
I have a "Baddie" object which handles a baddie on the screen, and when
one gets killed, and has finished it's death animation, I'm running a
method within the Baddie object cal
8 matches
Mail list logo