Create explosion effects dynamically with AS3.
Example comes preloaded with a small, medium, and large explosion effects. Easily customizable for additional effects.
Download Fla Sample
thanks for this nice example.
Some minor points:
- Main.as, timeHandler: Math.round(Math.random() * 2) does return 0, 1, or 2 with uneven chances; use floor instead
- Main.as, timeHandler: maybe it is easier to store the DisplayContainer for the different explos in an array and then just use a random num to acces an index in that array. No need for the inflexible if else if. Something like that may do:
private var _explos:Array = new Array();
_explos = [_smallExplosion,_mediumExplosion,_largeExplosion];
- why are there 3 different classes for 3 kinds of explosions though the code is identical? They are just instantiated with different values. Would it not be easier to have one explosion class instead and customize it using params?
Thanks for the tips! I’ll be sure to implement your suggestions and give you proper credit.
The reason there are 3 different Classes (one for each explosion effect) is because I found it easier to customize the effects that way. Each effect has a lot of parameters, so it was easier for me to do it this way.
There’s of course nothing wrong with having one abstract class and just passing it an object with parameters. It’s all about preference I suppose.
oh, and one more point I forgot to mention: use a bitmap for the burn marks instead of many movie clips. The mcs will slow down constantly the Flash player since they add up in numbers (createBurnMark in AbstractExplosion.as). Draw the burn mark to one single bitmap so that you never need to add an mc to the display list
Could You give some example code how to do that kind of update for that code? I really would like to use that Dynamic Exploasion Generator, but if it is possible to make some improvements I would like to have them
That’s a good quick and easy improvement to the current script. I was actually reworking the whole script to use blitting all around (explosions and burn marks). Not sure when I’ll be done with it…
I have downloaded the library and tried to publish but I get errors because it cannot find the Light, BurnMark and fireball objects – what should I do?
Make sure to unzip all the files before you try to publish the fla.
Hi there and thanks for a great script.
I like it a lot.
IÂ´m having one question, is it possible to make the external AS cod internal?
How do i do that?
You must be logged in to post a comment.