We will create a newGame() function that will get called every time the player crashes with an object. We're doing nothing, but just resetting our objects as they were initially when we started the game. So, here's how we do it:
public void newGame () { lowerBoundary.clear(); upperBoundary.clear(); rocks.clear(); minBoundaryHeight = 5; maxBoundaryHeight = 30; playerCharacter.resetScore(); playerCharacter.resetDYC(); playerCharacter.setYC(HEIGHT/2); for(int i = 0; i * 20 < WIDTH + 40;i++) { if(i == 0) { upperBoundary.add(new UpperBoundary(BitmapFactory.decodeResource (getResources(),R.drawable.ground), i * 20, 0, 10)); } else { upperBoundary.add(new UpperBoundary(BitmapFactory.decodeResource (getResources(),R.drawable. ...