Add zoom-in effect on attachements. Required for bubble gum, but looks actually qutie good on others too

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14108 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2013-09-20 00:09:06 +00:00
parent 001da20f42
commit 838fa746a7
2 changed files with 16 additions and 2 deletions

View File

@@ -48,7 +48,8 @@ Attachment::Attachment(AbstractKart* kart)
m_kart = kart;
m_previous_owner = NULL;
m_bomb_sound = NULL;
m_node_scale = 1.0f;
// If we attach a NULL mesh, we get a NULL scene node back. So we
// have to attach some kind of mesh, but make it invisible.
m_node = irr_driver->addAnimatedMesh(
@@ -111,7 +112,8 @@ void Attachment::set(AttachmentType type, float time,
}
clear();
m_node_scale = 0.3f;
// If necessary create the appropriate plugin which encapsulates
// the associated behavior
switch(type)
@@ -142,6 +144,8 @@ void Attachment::set(AttachmentType type, float time,
m_node->setCurrentFrame(0);
}
m_node->setScale(core::vector3df(m_node_scale,m_node_scale,m_node_scale));
m_type = type;
m_time_left = time;
m_previous_owner = current_kart;
@@ -360,6 +364,13 @@ void Attachment::update(float dt)
{
if(m_type==ATTACH_NOTHING) return;
m_time_left -=dt;
if (m_node_scale < 1.0f)
{
m_node_scale += dt*1.5f;
if (m_node_scale > 1.0f) m_node_scale = 1.0f;
m_node->setScale(core::vector3df(m_node_scale,m_node_scale,m_node_scale));
}
if(m_plugin)
{

View File

@@ -77,6 +77,9 @@ private:
/** For parachutes only. */
float m_initial_speed;
/** For zoom-in animation */
float m_node_scale;
/** Scene node of the attachment, which will be attached to the kart's
* scene node. */
scene::IAnimatedMeshSceneNode