Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Join Lee Brimelow in this project-style course that teaches how to build a Flash-based game with Flash Builder 4.6, Flash Player 11, and the Starling framework. Starling, a pure ActionScript 3.0 library for advanced graphics, extends Flash Player 11's support for the modern GPU (graphic processing unit) to enable visual presentations and games in the browser or as a mobile app.
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.
So now that we have our animated background in our menu state, the next thing we're going to add is the logo for our game. And if you look in the assets folder, remember that's in our Texture Atlas that we created, it is this logo right here. So now we're going to look at how you can extract this specific texture from that Texture Atlas. Okay, so I'm going to come under where we created our background, and I'm going to create a variable, I'm going to call it logo, and that's going to be equal to new Image.
And remember that when we want to extract a certain texture from the Texture Atlas, we're going to use that Texture Atlas that we created in our assets class, so I'm going to say Assets.ta, which is our Texture Atlas. Now there's two different methods that we can use, first is get texture, that's going to return a single texture. If we have an animation which is a series of frames, we would use getTextures and we will look at that later in the course. But for our purposes right now we're going to use the getTexture method and pass in the texture name which we want to get and it's called logo.
And if you don't remember what these names are, you can look in the atlas.xml file to see. So I'm going to create that as an instance variable, and what I'm going to do is to set its pivotX point. So much like in Flash where we can create a movie, we can give it a registration point and that's where the zero zero position is. And by default in Starling, it's going to be the upper left-hand corner just like Flash. If we wanted to put what is essentially the registration or the pivot point in the center, we can set its pivotX or pivotY properties.
I'm going to say logo.pivotX, and I'm going to set that = logo.width * 0.5; that's essentially going to put the pivotX point directly in the center of our logo. And this way, it's easy for me to position it in the center of our Menu state. So now to position the X position, I'm going to say logo.X = 400; because remember our game is 800 pixels wide.
For the Y position, and this is something you just have to do through trial and error is setting it at 250. And then lastly, I'm going to add that logo to our display list for our menu. So I'm going to test that, see what it looks like, and you can see now when we come in to our movie, we have our logo which is placed on top of our scrolling sky background. So that's basically how easy it is once you've created your Texture Atlas to get a specific texture.
It's just to simply give it its string name, it will retrieve that specific piece of our texture so that you can use it to display inside of an image object.
There are currently no FAQs about Building Flash Games with Starling.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.