The code structure
We will have two activities, one for the menu screen and one for the game screen. The menu screen activity will be called MainActivity, and the game screen activity will be called GameActivity. You can find all the completed code files as well as all the assets such as images, sprite sheets, and sound files in the Chapter8/Snake folder in the download bundle.
MainActivity
In contrast to our other projects, the menu screen will not have a UI designed in the Android Studio UI designer. It will consist of an animated snake head, a title, and a high score. The player will proceed to GameActivity by tapping anywhere on the screen. As we need to accomplish animations and user interactions, even the home screen will have a thread, a ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access