it would look like the code shown below...
Code: Select all
//
// ball of fire projectile, flies straight path, no curve.
//
void BadMojo::shootItBangItsDeadCharlie() {
scene::ISceneNodeAnimator* anim;
scene::ISceneNode* bill;
bool bImALazyBum = true;
bool bImSoLazyICantWriteThisCode = true;
if ( bImALazyBum || bImSoLazyICantWriteThisCode) {
// add light 1 (nearly red)
scene::ILightSceneNode* light1 =
smgr->addLightSceneNode(0, core::vector3df(0,0,0),
video::SColorf(0.5f, 1.0f, 0.5f, 0.0f), 800.0f);
// add fly animator to light 1
anim = smgr->createFlyStraightAnimator(bla,bla,bla);
light1->addAnimator(anim);
anim->drop();
// attach billboard to the light
bill = smgr->addBillboardSceneNode(light1, core::dimension2d<f32>(60, 60));
bill->setMaterialFlag(video::EMF_LIGHTING, false);
bill->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
bill->setMaterialTexture(0, driver->getTexture("../../media/particlered.bmp"));
// add particle system
scene::IParticleSystemSceneNode* ps =
smgr->addParticleSystemSceneNode(false, light1);
ps->setParticleSize(core::dimension2d<f32>(30.0f, 40.0f));
// create and set emitter
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d<f32>(-3,0,-3,3,1,3),
core::vector3df(0.0f,0.03f,0.0f),
80,100,
video::SColor(0,255,255,255), video::SColor(0,255,255,255),
400,1100);
ps->setEmitter(em);
em->drop();
// create and set affector
scene::IParticleAffector* paf = ps->createFadeOutParticleAffector();
ps->addAffector(paf);
paf->drop();
// adjust some material settings
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("../../media/fireball.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
}
}
Hope you're having fun there?