Introducing Starling by Thibault Imbert
Imbert begins with a discussion of the main features of Starling and how the APIs can enhance your FlashR 2D applications using Stage 3D and GPU acceleration. After a walk-through for downloading Starling and referencing as a ActionScript 3 library, you learn how to setup a basic scene. Imbert covers the differences and similarities of Starling to native Flash. He points out the differences from the Display List and touch events, as well as the Starling sprites and disposal methods.
Next the author discusses the event model and listeners. He covers how to leverage propagation and introduces Starling's useful removeEventListeners, which is a very easy way to efficiently manage event listeners. Moving to the next logical topic, he discusses touch events and how to use the Starling simulateMultiTouch property to simulate multi-touch events.
If you have worked on mobile applications, you know how important texture objects and the Texture API is to the performance of your app. Imbert introduces Starlings mipmapping which automatically creates scaled version of textures. He covers the custom image class and how to create an image object and pass a texture.
Collision detection is a part of almost any game and the author discusses how to create pixel perfect detection using hitTest API and alpha thresholds. Another aspect of any game is the need to draw objects on the screen. Imbert explains his sample code to draw inside the BitmapData object.
Animation is the next topic and Imbert explains how using flat sprites can enhance your games performance. For those times when movie clips are needed, the author suggests TexturePacker to create spritesheets from Flash exported image sequences. He explains his code for positioning the sprites from the XML and using a texture atlas to contain all your assets in one texture. You don't need to give up the useful Flash tweens because Starling has its own tween engine.
Buttons are the most common tool for user input. Imbert discusses how to skin and label buttons with his sample code for a scrolling background and menu buttons. Fonts and text go hand-in-hand with user input and displaying information such as game scores. Imbert discusses how text works in Starling, explains system and embedded fonts and how to handle text input. He also explains how Starling uses glyphs spritesheets for bitmap fonts.
The more advanced topics include asset management, system profiling, screen resizing and extensions for Starling such as Robotlegs and Box2D physics. He also discusses how to use ParticleDesigner to export a ParticleEmitter .pex file and texture for use with the particle extension.
This book is not for the beginner. It's not project-based and is heavy on code and API descriptions. However, if you have experience creating Flash games, this is a great introduction to the Starling framework. You can download a copy of the book from the O'Reilly website.
Thibault Imbert is a Senior Product Manager for Flash Runtime and an Adobe Certified Instructor. He can be found at bytearray.org.
Editor's Picks Articles
Top Ten Articles
Content copyright © 2019 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.