Since in our further chapters, we will be spawning obstacles and coins randomly on the screen, we will modify our player to navigate up and down on the screen. So, let's say if you touch your screen, the player will go up and if you stop touching the screen, our player will go down. Let us take a look at the changes we need to implement in our code first and then understand them step by step by breaking them down. We will be working on the GameView.java file for this code portion.
Initially, our animation used to start as soon as the game started. But we need a little bit more control over our actions so we used our getPlaying() function to achieve this. Here's how we will tackle this problem:
We added a condition in ...