diff --git a/demo/src/main.c b/demo/src/main.c index 7b363ff..e22c2bd 100644 --- a/demo/src/main.c +++ b/demo/src/main.c @@ -52,8 +52,11 @@ void draw() { if (mouseWentDown("left")) soundPlay(beep, FALSE); - groupCollideBetween(movement, 1); - groupPushGroup(edges, movement, 0.9); + int collision = FALSE; + if (groupCollideBetween(movement, 1)) collision = TRUE; + if (groupPushGroup(edges, movement, 0.9)) collision = TRUE; + + if (collision) soundPlay(beep, FALSE); drawSprites(); diff --git a/src/collider.c b/src/collider.c index 4113881..142639b 100644 --- a/src/collider.c +++ b/src/collider.c @@ -205,8 +205,8 @@ int heliCheckCollision( double kn = *vx*nx + *vy*ny; if (kn < 0) { - *vx -= 2*kn*fabs(bounciness)*nx; - *vy -= 2*kn*fabs(bounciness)*ny; + *vx -= kn*nx*(1 + fabs(bounciness)); + *vy -= kn*ny*(1 + fabs(bounciness)); } return TRUE;