Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Closed Thread
Thread Tools Rate Thread Display Modes
Old 03-13-2012, 02:39 PM   #1
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's Avatar
Join Date: Apr 2007
Location: Montréal, Québec
Posts: 5,473

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:
tacos is offline  
Old 03-13-2012, 03:21 PM   #3
Registered User
Join Date: Apr 2011
Posts: 27

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 03:26 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.