O'Reilly logo

WebGL Game Development by Sumeet Arora

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using texture animation for an explosion effect

In the last section of this chapter, we will create an animation effect with textures. We want the grenade to explode once its animation ends. Although explosions in games are created using particle physics, for simple explosions, we chose to confine ourselves to texture animation. So let's first understand what we mean by texture animation.

Until now, we were updating an object's location or rotation in our update function. In short, we were manipulating the ModelView matrix. Now, we will change the texture in our update function.

Let's slide back to the start of the chapter where we said that the Stage class holds the reference to all initialized textures and each StageObject holds the textureIndex ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required