diff --git a/src/object/coin.cpp b/src/object/coin.cpp index c87c9384f52..37becc0468f 100644 --- a/src/object/coin.cpp +++ b/src/object/coin.cpp @@ -192,14 +192,23 @@ HeavyCoin::update(float elapsed_time) void HeavyCoin::collision_solid(const CollisionHit& hit) { + int clink_threshold = 100; // sets the minimum speed needed to result in collision noise + //TODO: colliding HeavyCoins should have their own unique sound + if(hit.bottom) { + if(physic.get_velocity_y() > clink_threshold) + sound_manager->play("sounds/coin.wav"); physic.set_velocity_y(0); physic.set_velocity_x(0); } if(hit.right || hit.left) { + if(physic.get_velocity_x() > clink_threshold || physic.get_velocity_x() < clink_threshold) + sound_manager->play("sounds/coin.wav"); physic.set_velocity_x(-physic.get_velocity_x()); } if(hit.top) { + if(physic.get_velocity_y() < clink_threshold) + sound_manager->play("sounds/coin.wav"); physic.set_velocity_y(0); } } diff --git a/src/object/coin_explode.cpp b/src/object/coin_explode.cpp index e1853cf730b..35bca7db28b 100644 --- a/src/object/coin_explode.cpp +++ b/src/object/coin_explode.cpp @@ -32,7 +32,6 @@ CoinExplode::update(float ) int mag = 100; // madnitude that coins are to be thrown int rand = 30; // max variation to be subtracted from magnitide - //TODO: this needs its own snazzy sound Sector::current()->add_object(new HeavyCoin(position, Vector (2.5,-4.5)*(mag-gameRandom.rand(rand)))); Sector::current()->add_object(new HeavyCoin(position, Vector (2,-5)*(mag-gameRandom.rand(rand)))); Sector::current()->add_object(new HeavyCoin(position, Vector (1.5,-5.5)*(mag-gameRandom.rand(rand))));