Join Lee Brimelow for an in-depth discussion in this video Using the StarlingPool class, part of Building Flash Games with Starling.
- View Offline
So now in our BulletManager class we need to actually handle the creation and…destruction of bullets and this is a time to talk about a very important concept…for games and that's object pooling.…So one of the things that's most expensive performance-wise in games or…any application is when you instantiate a new object, because there is a lot of overhead.…So let's say in a game where I am constantly firing bullets like this one, every…time I fire a bullet I don't want to create a new bullet using the new keyword…and then when it's off the screen I destroy it.…
That repetitive process causes a lot of stuttering in your game and it's just a bad practice.…So this is where you want to use an object pool where at the beginning of…your game you create a pool of, in our case, we are going to create 100 bullets…in memory right at the beginning of our game and then we are just going to use…those bullets that are already in memory and just reuse them and that's…definitely the approach to take.…So back earlier in the course we actually linked to a class that I created…
Starting with installation and configuration of Starling and creation of a Flash Builder project, the course shows how to prepare and import graphical assets, create MovieClip classes from sprite sheets, manage various gaming objects, detect collisions, and add both particle and sound effects. The finished game can be deployed to any browser or mobile device that integrates Flash Player 11, which was released in September 2011.
- Downloading and installing Starling and Flash Builder
- Creating the project
- Creating the main game class, static assets class, and other classes
- Building the state machine
- Creating a static assets class
- Adding images
- Creating sprite sheets with Texture Packer
- Creating and importing bitmap fonts
- Detecting collisions
- Adding particle effects
- Adding sound effects