O'Reilly logo

Learning ShiVa3D Game Development by Wade Tracy

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

Game over

All good things must come to an end and if you aren't careful, that will include your ship. We already saw that we checked whether the ship health was 0 or less in the TakeDamage function. If it was, we made a call to DestroyShip, so let's create that function now, as given in the following code:

-- Get the scene and user objects local hScene = application.getCurrentUserScene ( ) local hUser = application.getCurrentUser ( ) -- Create an explosion based on the smaller collision explosions local hExplosion = scene.createRuntimeObject ( hScene, "ExplosionHelper" ) -- Move the explosion, scale it up and trigger the explosion object.matchTranslation ( hExplosion, this.hShip ( ), object.kGlobalSpace ) sfx.setParticleEmitterUniformScaleAt ( ...

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