Skip to content

Commit

Permalink
Added a secondary coin sound to distinguish between coins collected a…
Browse files Browse the repository at this point in the history
…nd coins interacting with the environment
  • Loading branch information
LMH0013 committed Sep 3, 2013
1 parent 8e25c0c commit f8e7c8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Binary file added data/sounds/coin2.ogg
Binary file not shown.
10 changes: 5 additions & 5 deletions src/object/coin.cpp
Expand Up @@ -178,7 +178,7 @@ HeavyCoin::HeavyCoin(const Vector& pos, const Vector& init_velocity)
physic()
{
physic.enable_gravity(true);
sound_manager->preload("sounds/coin.wav");
sound_manager->preload("sounds/coin2.ogg");
set_group(COLGROUP_MOVING);
physic.set_velocity(init_velocity);
}
Expand All @@ -188,7 +188,7 @@ HeavyCoin::HeavyCoin(const Reader& reader)
physic()
{
physic.enable_gravity(true);
sound_manager->preload("sounds/coin.wav");
sound_manager->preload("sounds/coin2.ogg");
set_group(COLGROUP_MOVING);
}

Expand All @@ -207,7 +207,7 @@ HeavyCoin::collision_solid(const CollisionHit& hit)

if(hit.bottom) {
if(physic.get_velocity_y() > clink_threshold)
sound_manager->play("sounds/coin.wav");
sound_manager->play("sounds/coin2.ogg");
if(physic.get_velocity_y() > 200) {// lets some coins bounce
physic.set_velocity_y(-99);
}else{
Expand All @@ -217,12 +217,12 @@ HeavyCoin::collision_solid(const CollisionHit& hit)
}
if(hit.right || hit.left) {
if(physic.get_velocity_x() > clink_threshold || physic.get_velocity_x() < clink_threshold)
sound_manager->play("sounds/coin.wav");
sound_manager->play("sounds/coin2.ogg");
physic.set_velocity_x(-physic.get_velocity_x());
}
if(hit.top) {
if(physic.get_velocity_y() < clink_threshold)
sound_manager->play("sounds/coin.wav");
sound_manager->play("sounds/coin2.ogg");
physic.set_velocity_y(-physic.get_velocity_y());
}
}
Expand Down

0 comments on commit f8e7c8b

Please sign in to comment.