From the course: Building Flash Games with Starling
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Adding the background
From the course: Building Flash Games with Starling
Adding the background
So the first thing we're going to do in our play state, very similar to what we did in the menu state, is to add that scrolling background to it. So the same way I did in the menu state, I'm going to come into the init event handler and I'm going to create a variable called background, that's going to be equal new Background; and we're going to want to create that as an instance variable, and we want to add that background to our display list. And again, in the update method for our play state which will be called on every frame, we're going to go ahead and update that background. So background.update, and we can save that and let's go ahead and test it. So again when we first come into the game, we're in our menu state and then when I click PLAY GAME we're now essentially in the play state for our game, but it has that similar scrolling background associated with it. So again, that's the first part of our play state.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Adding the background1m 3s
-
Creating the Hero class6m 14s
-
Creating the Bullet class1m 44s
-
Creating the BulletManager class4m 23s
-
Using the StarlingPool class9m 24s
-
Firing bullets with the mouse7m 24s
-
Creating the Alien movie clip1m 58s
-
Creating the AlienManager class8m 12s
-
Overview of collision-detection options3m 10s
-
Creating the CollisionManager class10m 51s
-
Implementing the destroy method2m 24s
-
-
-
-
-