Added sound effect when a player_kart is overtaken.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1662 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-03-18 01:41:06 +00:00
parent cd9b506173
commit ef4de3a790
4 changed files with 16 additions and 2 deletions

View File

@ -147,7 +147,7 @@ public:
{ m_attachment.set(attachment_, time); }
void setCollectable (CollectableType t, int n)
{ m_collectable.set(t, n); }
void setPosition (int p)
virtual void setPosition (int p)
{ m_race_position = p; }
int getSector () const { return m_track_sector; }
float getDistanceDownTrack() const { return m_curr_track_coords[1]; }

View File

@ -95,7 +95,7 @@ void KartProperties::load(const std::string filename, const std::string node,
m_model = loader->load(m_model_file, CB_KART, false);
if(!m_model)
{
fprintf(stderr, "Can't find kart model '%s'.\n",m_model_file);
fprintf(stderr, "Can't find kart model '%s'.\n",m_model_file.c_str());
file_manager->popTextureSearchPath();
file_manager->popModelSearchPath();
return;

View File

@ -179,6 +179,18 @@ void PlayerKart::crashed()
}
} // crashed
//-----------------------------------------------------------------------------
/** Checks if the kart was overtaken, and if so plays a sound
*/
void PlayerKart::setPosition(int p)
{
if(getPosition()<p)
{
sound_manager->playSfx(SOUND_BEEP);
}
Kart::setPosition(p);
} // setPosition
//-----------------------------------------------------------------------------
void PlayerKart::handleZipper()
{

View File

@ -56,6 +56,8 @@ public:
void crashed ();
void handleZipper ();
void collectedHerring (Herring* herring);
virtual void setPosition (int p);
int isPlayerKart () const {return 1;}
void reset();