Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So in the last movie we created our smoke particle effect, which is attached to our hero ship. Now we are going to create the explosion effect which happens when a bullet hits an alien. Now this one is going to be little different because we are going to need to create a lot of these potentially. So we are going to need to make sure that we manage them. So we are first going to create an Explosion class which is going to subclass the PDParticleSystem, and then we are going to create an ExplosionManager which is going to help us track these in our game.
So I'm going to go to our objects class and create a new ActionScript Class, and I'm going to call it Explosion and this is going to have a Superclass of PDParticleSystem and click Finish. So now in the constructor here it's expecting us to send in the config and the texture, so now we need to embed that into our assets class. So I'm going to copy the one that we have for our smoke particle effect and paste it, and this one is going to be explosion.pex and we are going to call this explosionXML.
Okay, so what I'm going to do now is go back to my Explosion class and I'm going to remove these from the constructor because we are going to send them into the super constructor. And for the config, again, I'm going to need to cast it to XML (new Assets.explosionXML) and then we are going to get our explosion texture out of our texture atlas. So we are going to say Assets. ta.getTexture("explosion").
So now essentially we have a new PDParticleSystem that's using the explosionXML and the explosion texture. Now we are actually going to be managing these using an ExplosionManager class, which we are going to create in the next movie.
Get unlimited access to all courses for just $25/month.Become a member