Adding the play button


show more Adding the play button provides you with in-depth training on Developer. Taught by Lee Brimelow as part of the Building Flash Games with Starling show less
please wait ...

Adding the play button

So the next thing we need to add to our menu state is our Play button, and this is obviously what you're going to click on when you want to actually start playing the game. So Starling actually has a class called Button which makes it very easy obviously to create buttons. So I'm going to come under our logo here, create a new variable called play, I'm going to set that equal to a new instance of the Starling.display.button class. Into this you can pass in different textures for the up and the down states, we're not going to deal with that, we're just going to do an up state to keep it simple.

And for the texture, again, we're going to use a texture which is in that texture atlas. So Assets.ta.getTexture and the texture is called "playButton", and let's go ahead and create that playButton as an instance variable. Now when we're dealing with buttons there is a special event in Starling called a triggered event and that's essentially going to b...

Adding the play button
Video duration: 3m 4s 2h 57m Intermediate

Viewers:

Adding the play button provides you with in-depth training on Developer. Taught by Lee Brimelow as part of the Building Flash Games with Starling

please wait ...