Adding the sound to the project
Before we get to the code let's add the sound files to the project. You can find all the files in the assets folder inside the Chapter 17 folder on the GitHub repo. Copy the entire assets folder; then, using your operating system's file browser, go to the Snake/app/src/main folder of the project and paste the folder along with all the files. The sound effects are now ready for use.
Let's code the Snake class.