Creating variables

As you should be aware by now, we will work on our GameView.java file to display our explosion. So, open up your GameView.java file. We will start by creating a few variables, as follows:

private ExplosionEffect explosionEffect;private long startReset;private boolean reset;private boolean started;

We created the explosionEffect variable to get a reference to our ExplosionEffect class and the other variables we have created in order to make our player reset after it collides. So, basically, what we will do is that once the player collides with a rock, an explosion animation will play and the player will get reset to the initial state.

Get Learning Android Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.