better sounds two at a time
This commit is contained in:
parent
a5f55c4272
commit
fe310d2fe8
2 changed files with 8 additions and 6 deletions
|
@ -9,6 +9,10 @@ function Block(lane, color, distFromHex, settled) {
|
|||
this.angularVelocity = 0;
|
||||
this.targetAngle = this.angle;
|
||||
this.color = color;
|
||||
if (window.chrome){
|
||||
colorSounds[this.color].load();
|
||||
}
|
||||
colorSounds[this.color].play();
|
||||
|
||||
if (distFromHex) {
|
||||
this.distFromHex = distFromHex;
|
||||
|
@ -96,11 +100,7 @@ function Clock(sideLength) {
|
|||
block.distFromHex = MainClock.sideLength / 2 * Math.sqrt(3) + block.height * this.blocks[lane].length;
|
||||
this.blocks[lane].push(block);
|
||||
consolidateBlocks(this, lane, this.blocks[lane].length - 1);
|
||||
if (window.chrome){
|
||||
colorSounds[block.color].load();
|
||||
}
|
||||
colorSounds[block.color].play();
|
||||
};
|
||||
};
|
||||
|
||||
this.doesBlockCollide = function(block, iter, position, tArr) {
|
||||
if (block.settled) {
|
||||
|
|
|
@ -55,7 +55,9 @@ function render() {
|
|||
document.getElementById("score").innerHTML = score + " (x" + scoreScalar * scoreAdditionCoeff + ")";
|
||||
var now = Date.now();
|
||||
if (now - lastGen > nextGen) {
|
||||
blocks.push(new Block(randInt(0, 6), colors[randInt(0, colors.length)]));
|
||||
var x = randInt(0, MainClock.sides);
|
||||
blocks.push(new Block(x, colors[randInt(0, colors.length)]));
|
||||
blocks.push(new Block((x+MainClock.sides/2)%MainClock.sides, colors[randInt(0, colors.length)]));
|
||||
lastGen = Date.now();
|
||||
var minTime = 500 / iter;
|
||||
if (minTime < 100) {
|
||||
|
|
Loading…
Reference in a new issue