Skip to content

Commit

Permalink
better sound fix
Browse files Browse the repository at this point in the history
  • Loading branch information
increpare committed May 8, 2015
1 parent 2928acd commit 3a2fde8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pinball.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,11 @@ function ballCollides(){
var lastsoundpos_bump=-1;
var oldscore=0;
function tick(){

var tempsoundpos = Math.round(bpx)+1000*Math.round(bpy);
if (tempsoundpos!==lastsoundpos_bump){
lastsoundpos_bump=-1;
}
if (oldscore!==score){
// If the user has more points than the currently stored high score then
if (score > highScore) {
Expand Down Expand Up @@ -1096,7 +1101,7 @@ function ballCollides(){
playSound(targetsound,bumperCount===0);
}
lastsoundpos_bump=soundpos;

var direction = (nSpeed[0]*normal[1]-nSpeed[1]*normal[0]);
/* if (direction<0){
console.log("left");
Expand Down

0 comments on commit 3a2fde8

Please sign in to comment.