Join Lee Brimelow for an in-depth discussion in this video Building the state machine, part of Building Flash Games with Starling.
- View Offline
Okay, so now we have our three main game states created.…Now our main Game class is going to actually incorporate a state machine and its…whole purpose is going to be to switch between the various states of our game.…So with the top of Game class, I am going to define three constants which are…actually going to represent each of the states in the state machine.…So I am going to say public, and these are going to be static so that we can…reference them anywhere and they are going to be directly attached to our class,…and we are going to say const for constant, and the first one is going to be…MENU_STATE and these are going to be simple integer values, and they just have to…contain unique integer values.…
I am going to set this one equal to zero.…I am going to duplicate that twice and now we are going to change this to…PLAY_STATE and I am going to make this one a value of 1. We'll make this one a…value of 2 and change it to GAME_OVER_STATE, like that.…So again, just these three constants and this is going to enable us to reference…
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