The code for the finished game project is available on GitHub, in a public repository. If you have Git and Android Studio installed on your development computer, you can clone the project and immediately open it in Studio. Alternatively, you can download the project as a ZIP archive file and extract it to your system. You can then open it in Android Studio 2.2 or later.
- [Instructor] You can download the Balloon-Popper game app's code from this public repository on GitHub at github.com/davidgassner/balloon-popper. If you have Git installed on your computer and you know how to use it with Android Studio, you can clone the repository using this web URL. Or you can download the repo as a ZIP file by clicking on this link. Now, I've already downloaded the ZIP file and I'll open it in Finder on Mac.
If you're working on Windows, go to Explorer. Now, I'll drag the ZIP file onto my desktop. I'll close everything down. And then I'll extract the ZIP file right here. I'll then take this directory and rename it as just BalloonPopper without any special characters or spaces. This is an Android Studio project, so now I'll go to Android Studio, to the Welcome screen. I'll choose Open an existing Android Studio project.
I'll then press Command + D on Mac or Control + D on Windows to go to my Desktop directory and then I'll select and open the BalloonPopper project. Now again, if you're using Git, you'll follow a different set of steps to clone the repository into Android Studio. Either way, you should now have a project. Now if this happens and you don't see any files open in the project window, close the project and then reopen it again from the Welcome screen.
And this time the files should show up successfully. Before I test the project and run the application, I want to show you something in the top level build.gradle file. That's the build file for the project, not the module. The classpath points to the Gradel plug-in version. I'm using Android Studio 2.2 Preview 6, a pre-release version. This plug-in version always matches the version of Android Studio you're using. So 2.2.0-alpha6 matches Preview 6.
If you're using a more recent version of Android Studio, this might not match your version and you'll have to update it. Android Studio will usually prompt you to make this upgrade and just follow its suggestions. But if that doesn't happen, this is where you would need to make the change. Now again, I'm planning to update the repository whenever Android Studio is updated, but if there's a mismatch, this is where you fix it. To test the application I recommend using a physical device.
I'm using a Nexus 5X that I've connected to my computer. And I've turned on USB debugging. You can also use an emulator if you need to, but with a physical device you'll get a better sense of the sound and general experience that the user will have. I'll go back to Android Studio. And then I'll click the Run button on the toolbar. My Nexus 5X is connected and shows up here. Notice that it's running Android 7 Nougat, API 24. You can test on older versions of Android as well.
This app is designed to only run in landscape orientation. So when it loads onto the device, the orientation will change automatically. Now I'll play the game. I won't talk while the game's being played, so you can hear the sounds and other audio effects. (light instrumental music) (popping) (popping) (light instrumental music) (popping) (light instrumental music) (popping) (popping) (light instrumental music) (popping) (light instrumental music) (popping) When the game is over, I see dialog showing me my new accomplishments.
I've achieved more levels than I have before. And I have a New Top Score. When I clear the dialogs and press the background, I'm ready to play the game again. So that's the basic game. It has multiple levels. Each level has 10 balloons. You have five pins to work with. Each time you miss a balloon and it touches the top of the screen, you lose a pin. And when all the pins are gone, the game is over. So for the rest of this course, I'll describe how this game was built.
In some of the videos, I'll take you through some hands-on exercises. But for much of the course, I'll be reviewing pre-existing code. Describing how the game is put together, where its logic resides, and why I made certain choices about the nature of the game and the user experience.
- Working with Java vs. C++
- Creating a new Android project
- Defining the visuals: background, menus, and animation
- Defining and managing levels
- Displaying scores
- Managing limited gaming resources
- Completing the game logic
- Adding audio effects