Adding some fire tiles

These new GameObject derived objects will mean instant death to Bob. They won't move, but they will be animated. We will see we can achieve this just by setting the already existing properties of GameObject.

Adding this feature into our game is simple because we have already implemented all the features we need. We already have a way to locate and add new tiles, a way to detect and respond to a collision, sprite sheet animation, and so on. Let's do it step-by-step, then we can add these dangerous and life-threatening elements into our world.

We can put the entire functionality of the class into its constructor. All we do is configure the object much like we did our Grass object, but in addition, we configure it with all the ...

Get Android Game Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.