From the course: Building Flash Games with Starling
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating the ExplosionManager class
From the course: Building Flash Games with Starling
Creating the ExplosionManager class
So now that we've created our explosion particle class here, we're going to create an ExplosionManager to help track these in our game. So I'm going to right-click on the managers package, New > ActionScript Class, and this is going to be ExplosionManager, and click Finish. Now much like the other managers, we're going to send in our play state to the constructor, and I'm going to set that as an instance variable, this.play = play. Okay, so much like the AlienManager and the BulletManager, we're going to use an object pool here to hold our particle effects. These are the things that you don't want to be instantiating in the middle of your gameplay. So I'm going to create a variable called pool, and that's going to be equal to new StarlingPool. and for the type it's going to be a type of Explosion, make sure we import that. And we're going to create 15 of them, and again that's a number that you're going to have to trial and error depending on your game for the least number that you…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.