
In our lesson about shooting the logo plaque is made invisible if we have a good shoot. But now we know how to make explosions: using particles.
We change the part of the avatarobj script:
-- ... previous code
if(collisionData.modelB.name="logo") then
if(flagse=0) then
expl1 = myworld.newModelResource("expl", #particle)
myworld.newModel("expl", expl1)
expl1.emitter.maxSpeed = 60
expl1.emitter.numParticles = 1000
expl1.emitter.angle = 160
expl1.emitter.direction = vector( 0, 1, 0)
expl1.lifeTime = 1000
expl1.colorRange.start = rgb(255, 255, 128)
expl1.colorRange.end = rgb(192, 96, 0)
expl1.sizeRange.start = 60
expl1.emitter.mode = #stream
myworld.modelResource("expl").emitter.region = [myworld.model("logo").worldposition]
flagse = 1
end if
--myworld.model("logo").visibility = #none
-- ... the rest of the code
Play the demo. Now it has an explosion image!!!. You need to destroy the plaque with the logo. To shoot press the space bar.To shoot again you need to recharge the bazooka pressing the r key!!!! You only can do this after the beep The demo has sound! Walk as usual, using the arrow keys.
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
