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);
}
}
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))));