Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-13-2012, 02:39 PM   #1
jaeger138
Registered User
 
Join Date: Apr 2011
Posts: 27
Default [AS2] Death Animation

Can someone please give me an example of some code that would, when an MCs 'health' variable is reduced to 0, play a death animation from frames 1 to 42 and then remove the clip from the scene? I can't seem to get it to remove or play the full animation before it removes, it just stops on frame 2 and keeps on going.
jaeger138 is offline  
Old 03-13-2012, 03:07 PM   #2
tacos
Grrrrrrrrreat!
 
tacos's Avatar
 
Join Date: Apr 2007
Location: Montréal, Québec
Posts: 5,473
Default

ActionScript Code:
this.onEnterFrame = function(){     if(_level0.some_mc.health < 1){         this.attachMovie("linkageName", "death_mc", this.getNextHighestDepth(),{_x:100, _y:100});         delete this onEnterFrame;     } };

And in the death_mc itself, on it's last frame...

ActionScript Code:
this.unloadMovie();
__________________
WHO I WAS...
BANDS OF THE 80's
tacos is offline  
Old 03-13-2012, 03:21 PM   #3
jaeger138
Registered User
 
Join Date: Apr 2011
Posts: 27
Default

You rock! tweaked it a little to my needs but that was perfect! Thank you you wonderful person.
jaeger138 is offline  
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:38 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.