Edited nitro PNG to be more circular and tweaked emision so it looks like

the kart is leaving a fire trail. Also made it fire even if stopped, so
driver sees nitro works (wasting it).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3600 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
mbjornstk 2009-06-09 23:04:18 +00:00
parent 5771a2b538
commit 2a99182969
2 changed files with 16 additions and 12 deletions

View File

@ -29,7 +29,7 @@
Nitro::Nitro(Kart* kart) : m_kart(kart)
{
const float particle_size = 0.5f;
const float particle_size = 0.25f;
m_node = irr_driver->addParticleNode();
m_node->setParent(m_kart->getNode());
m_node->setPosition(core::vector3df(0, particle_size*0.25f, -m_kart->getKartLength()*0.5f));
@ -37,13 +37,17 @@ Nitro::Nitro(Kart* kart) : m_kart(kart)
m->setMaterialProperties(&(m_node->getMaterial(0)));
m_node->setMaterialTexture(0, m->getTexture());
m_emitter = m_node->createPointEmitter(core::vector3df(0, 0, 0), // velocity in m/ms
5, 10,
video::SColor(255,0,0,0),
video::SColor(255,255,255,255),
400, 400,
20 // max angle
);
m_emitter = m_node->createBoxEmitter(core::aabbox3df(-m_kart->getKartWidth()*0.3f, 0.1f, -m_kart->getKartLength()*0.1f,
m_kart->getKartWidth()*0.3f, 0.1f + m_kart->getKartHeight()*0.5f, -m_kart->getKartLength()*0.3f),
core::vector3df(0.0f, 0.03f, 0.0f),
5, 10,
video::SColor(255,0,0,0),
video::SColor(255,255,255,255),
150, 250, // Min max life milisec
40, // Angle
core::dimension2df(particle_size/2.0f, particle_size/2.0f),
core::dimension2df(particle_size*2.0f, particle_size*2.0f)
);
m_emitter->setMinStartSize(core::dimension2df(particle_size/2.0f, particle_size/2.0f));
m_emitter->setMaxStartSize(core::dimension2df(particle_size*2.0f, particle_size*2.0f));
m_node->setEmitter(m_emitter); // this grabs the emitter
@ -68,9 +72,9 @@ void Nitro::update(float t)
// There seems to be no way to randomise the velocity for particles,
// so we have to do this manually, by changing the default velocity.
// Irrlicht expects velocity (called 'direction') in m/ms!!
Vec3 dir(cos(DEGREE_TO_RAD(rand()%180))*0.003f,
sin(DEGREE_TO_RAD(rand()%180))*0.003f,
sin(DEGREE_TO_RAD(rand()%100))*0.003f);
Vec3 dir(cos(DEGREE_TO_RAD(rand()%180))*0.001f,
sin(DEGREE_TO_RAD(rand()%180))*0.001f,
sin(DEGREE_TO_RAD(rand()%100))*0.001f);
m_emitter->setDirection(dir.toIrrVector());
} // update

View File

@ -1070,7 +1070,7 @@ void Kart::updateGraphics(const Vec3& off_xyz, const Vec3& off_hpr)
}
if(m_nitro)
m_nitro->setCreationRate(m_controls.m_nitro && m_collected_energy>0
? getSpeed()*5.0f : 0);
? (10.0f + getSpeed()*20.0f) : 0);
float speed_ratio = getSpeed()/getMaxSpeed();
float offset_heading = getSteerPercent()*m_kart_properties->getSkidVisual()