removed for-in loops; cleaned up syntax

This commit is contained in:
meadowstream 2014-06-22 12:49:27 -04:00
parent 7ff7dec0d8
commit 75c5374fc3
2 changed files with 9 additions and 9 deletions

View file

@ -13,28 +13,28 @@ function render() {
drawPolygon(trueCanvas.width / 2 , trueCanvas.height / 2 , 6, (settings.rows * settings.blockHeight) * (2/Math.sqrt(3)) + settings.hexWidth, 30, grey, false,6);
ctx.globalAlpha = 1;
}
for (var i in MainClock.blocks) {
var i;
for (i = 0; i < MainClock.blocks.length; i++) {
for (var j = 0; j < MainClock.blocks[i].length; j++) {
var block = MainClock.blocks[i][j];
block.draw(true, j);
}
}
for (var i in blocks) {
for (i = 0; i < blocks.length; i++) {
blocks[i].draw();
}
MainClock.draw();
if ( gameState ==1 | gameState ==-1 ) {
drawScoreboard();
}
for (var i in MainClock.texts) {
for (i = 0; i < MainClock.texts.length; i++) {
var alive = MainClock.texts[i].draw();
if(!alive){
MainClock.texts.splice(i,1)
MainClock.texts.splice(i,1);
}
i--;
}

View file

@ -15,12 +15,12 @@ function blockDestroyed() {
function waveGen(clock) {
this.lastGen = 0;
this.last = 0;
this.nextGen = 1650; // - 1500; //delay before starting
this.nextGen = 2000; // - 1500; //delay before starting
this.start = 0;
this.colors = colors;
this.ct = 0;
this.clock = clock;
this.difficulty = 0;
this.difficulty = 1;
this.dt = 0;
this.update = function() {
this.currentFunction();
@ -28,7 +28,7 @@ function waveGen(clock) {
this.computeDifficulty();
if (this.dt - this.lastGen * (1/settings.creationSpeedModifier) > this.nextGen) {
if (this.nextGen > 1000) {
this.nextGen -= (.7 * (this.nextGen/1300)) * settings.creationSpeedModifier;
this.nextGen -= (0.7 * (this.nextGen/1300)) * settings.creationSpeedModifier;
}
}
};