Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Android Game Development

You're reading from   Learning Android Game Development A Beginner's guide to developing popular Android games

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781785880957
Length 238 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nikhil Malankar Nikhil Malankar
Author Profile Icon Nikhil Malankar
Nikhil Malankar
Arrow right icon
View More author details
Toc

Creating explosions


We're almost done with our game here, and only the following two parts are remaining:

  • Adding particle effects of an explosion
  • Displaying our score on the screen

We will divide this part into two sections wherein we will finish half of our explosions in this chapter, and the further half will be completed along with the UI of our game that will then conclude this game. So, let's get started with this now. For our explosion, we will be needing a sprite sheet. We will use the following sprite sheet for our game:

Our explosion sprite sheet

We will create a new class named ExplosionEffect.java. Note here that we will not be extending this file to our GameObj file since we don't need any of the collision components of this image. We will simply spawn it on the screen and make it stay at the same place. So, open up your ExplosionEffect.java file and let's define our variables first:

private int xc;
private int yc;
private int height;
private int width;
private int row;
private AnimationClass...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime