Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So in this chapter, we're going to focus on the GameOver state. Now this is going to be similar to the menu state. We're going to have that same animated background, we're going to have a game over text field, and then we're simply going to have a button that says essentially Try Again, so you can actually try to play the game again. So we're going to do the background first. So I'm going to come into my init method and I'm going to create a new property, call it background = new Background, and let's go ahead and create that as an instance variable.
Now I need to add this to the display list; so addChild(background). And much like before, in our update method, we're going to call the update method of our background. So background.update(); and that's all we need to do for the background, but let's go ahead and make sure that it's working. So we'll test it, go to Play Game, we'll make sure the game is over there, and we can see we're now in our GameOver state with our scrolling background.
So in the next movie, we're actually going to focus on creating a text field using that bitmap font that says Game Over.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 98693 Viewers
61 Video lessons · 86019 Viewers
71 Video lessons · 69865 Viewers
56 Video lessons · 102148 Viewers
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.
Your file was successfully uploaded.