diff --git a/goo.cpp b/goo.cpp index d687c5d..80ed9ac 100644 --- a/goo.cpp +++ b/goo.cpp @@ -3,6 +3,8 @@ #include +#include "publicclass.h" + Goo::Goo( int radius, QObject *parent) : QObject(parent) { @@ -200,7 +202,18 @@ void Goo::drag(){ info.speed=body->GetLinearVelocity(); info.aForce=body->GetAngularVelocity(); } - if (!hasJoint()) body->SetActive(false); + if (!hasJoint()) { + if (!dragging){ + ALbyte name[100]="resources/sounds/drag.wav"; + QPair source =soundSystem.createSource(name); + soundSystem.setPitch(source.first,float(radius)/20.0); + soundSystem.setVolume(source.first,radius/24.0); + soundSystem.setPosition(source.first,getPPosition()); + soundSystem.playSource(source.first); + soundSystem.addSource(source); + } + body->SetActive(false); + } body->SetLinearVelocity(b2Vec2(0,0)); body->SetAngularVelocity(0); dragging=true; @@ -255,6 +268,15 @@ void Goo::checkForConnection(Goo *goo){ } void Goo::fallDown(){ + if (!falling){ +// ALbyte name[100]="resources/sounds/scream.wav"; +// QPair source =soundSystem.createSource(name); +// soundSystem.setPitch(source.first,float(radius)/20.0); +// soundSystem.setVolume(source.first,radius/24.0); +// soundSystem.setPosition(source.first,getPPosition()); +// soundSystem.playSource(source.first); +// soundSystem.addSource(source); + } onGround=false; falling=true; stopFollow(); diff --git a/resources/sounds/drag.wav b/resources/sounds/drag.wav new file mode 100644 index 0000000..ee8c251 Binary files /dev/null and b/resources/sounds/drag.wav differ diff --git a/resources/sounds/scream.wav b/resources/sounds/scream.wav new file mode 100644 index 0000000..6a33096 Binary files /dev/null and b/resources/sounds/scream.wav differ