Join Lee Brimelow for an in-depth discussion in this video Creating the Score class, part of Building Flash Games with Starling.
- View Offline
So the last thing we are going to add to our game is just a simple high…score text field.…And what I'm going to do is create a new object class. I am going to go to my…objects package, say New > ActionScript Class, and I am going to call it Score.…Now I am just going to subclass Sprite.…Now if you only literally wanted a text field, you could in subclass text field.…But I am just using this because, generally speaking, you might want to add more…to it in the future, and if so, you need to display object container.…So I am going to subclass starling. display.Sprite, and in the constructor here I…am going to create a new variable called score, and that's going to be equal to…a new text field object, a new starling.text.TextField.…
And to the constructor of this I am going to give it a width of 300, height of 100.…I am going to give it an initial text value of 0, because we don't have any…score when we come in.…I am going to use the KomikaAxis font.…That's our bitmap font that we included.…I am going to give it a size of 32 and a color of white.…
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