Commit d04cf2d7 by ogomez92

engine sound

parent 5e0916da
......@@ -39,7 +39,7 @@ class Car {
}
if (this.currentGear==0) this.currentGear=1;
if (this.getGear()>this.currentGear) this.currentGear=this.getGear();
this.sndEngine.playbackRate=utils.progressPitch(this.speed/this.currentGear,this.speedPerGear);
this.sndEngine.playbackRate=utils.progressPitch(this.speed/this.currentGear,1,this.speedPerGear,1,1.8);
this.player.speed=this.speed*0.0004;
this.player.move();
return;
......
......@@ -3,8 +3,8 @@ class GameUtils {
progressPan(current, max) {
return ((current*200/max)-100)/100;
}
progressPitch(current,max) {
return ((current*200/max))/100;
progressPitch(current,min,max,minPitch,maxPitch) {
return (current/(min+max))*(maxPitch-minPitch)+minPitch;
}
distance3D(x1, y1, z1, x2, y2, z2) {
return Math.sqrt((x2 - x1) * (x2 - x1) +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment