cleaned up main, made new difficulty scaling system, removed .swp files,

added greater support for mobile (responsiveness of btns)
This commit is contained in:
meadowstream 2014-05-31 21:43:12 -04:00
parent 62fb2ee074
commit 43d3fa4516
5 changed files with 40 additions and 30 deletions

Binary file not shown.

Binary file not shown.

View file

@ -3,15 +3,18 @@ function showText(text){
var messages = {
'paused':"<div class='centeredHeader unselectable'>Paused</div><br><div class='unselectablecenteredSubHeader'>Press p to resume</div>"
}
var pt = document.getElementById("overlay");
pt.className = '';
pt.innerHTML = messages[text];
}
function hideText(text){
var pt = document.getElementById("overlay");
pt.className = 'faded';
pt.innerHTML = '';
}
function pause(x,o,message) {
if(x === undefined){x=true;}
message = 'paused';
@ -98,7 +101,7 @@ keypress.register_combo({
});
$(document).ready(function(){
$("#pauseBtn").mousedown(function() {
$("#pauseBtn").on('touchstart mousedown', function() {
pause();
if ($($("#pauseBtn").children()[0]).attr('class').indexOf('pause') == -1) {
$("#pauseBtn").html('<i class="fa fa-pause fa-2x"></i>');

View file

@ -22,9 +22,13 @@ function update() {
waveone.prevTimeScored = now;
}
}
var lowestDeletedIndex;
var i;
var j;
var block;
var objectsToRemove = [];
for (var i in blocks) {
for (i in blocks) {
MainClock.doesBlockCollide(blocks[i]);
if (!blocks[i].settled) {
if (!blocks[i].initializing) blocks[i].distFromHex -= blocks[i].iter * settings.scale;
@ -33,36 +37,37 @@ function update() {
}
}
for (var i = 0; i < MainClock.blocks.length; i++) {
for (var j = 0; j < MainClock.blocks[i].length; j++) {
for (i = 0; i < MainClock.blocks.length; i++) {
for (j = 0; j < MainClock.blocks[i].length; j++) {
if(MainClock.blocks[i][j].checked ==1 ){
consolidateBlocks(MainClock,MainClock.blocks[i][j].attachedLane,MainClock.blocks[i][j].getIndex());
MainClock.blocks[i][j].checked=0;
}
}
}
var lowestDeletedIndex;
for (var i = 0; i < MainClock.blocks.length; i++) {
for (i = 0; i < MainClock.blocks.length; i++) {
lowestDeletedIndex = 99;
for (j = 0; j < MainClock.blocks[i].length; j++) {
block = MainClock.blocks[i][j];
if (block.deleted == 2) {
MainClock.blocks[i].splice(j,1);
blockDestroyed();
if (j < lowestDeletedIndex) lowestDeletedIndex = j;
j--;
}
}
if (lowestDeletedIndex < MainClock.blocks[i].length) {
for (var q = lowestDeletedIndex; q < MainClock.blocks[i].length; q++) {
for (j = lowestDeletedIndex; q < MainClock.blocks[i].length; q++) {
MainClock.blocks[i][q].settled = 0;
}
}
}
for (var i in MainClock.blocks) {
for (var j = 0; j < MainClock.blocks[i].length; j++) {
var block = MainClock.blocks[i][j];
for (i in MainClock.blocks) {
for (j = 0; j < MainClock.blocks[i].length; j++) {
block = MainClock.blocks[i][j];
MainClock.doesBlockCollide(block, j, MainClock.blocks[i]);
if (!MainClock.blocks[i][j].settled) {
@ -71,7 +76,7 @@ function update() {
}
}
for(var i=0;i<blocks.length;i++){
for(i = 0; i < blocks.length;i++){
if (blocks[i].removed == 1) {
blocks.splice(i,1);
i--;

View file

@ -1,6 +1,16 @@
// In each generator function you need a few things
// Something defining when the next block is being generated
// Something defining which and when the next function is going to be passed
function blockDestroyed() {
if (waveone.nextGen > 1000) {
waveone.nextGen -= 10;
} else {
waveone.nextGen = 1000;
}
if (waveone.difficulty < 15) {
waveone.difficulty += 0.075;
} else {
waveone.difficulty = 15;
}
}
function waveGen(clock) {
this.lastGen = 0;
@ -19,7 +29,7 @@ function waveGen(clock) {
this.computeDifficulty();
if (this.dt - this.lastGen * (1/settings.creationSpeedModifier) > this.nextGen) {
if (this.nextGen > 1000) {
this.nextGen -= (3 * (this.nextGen/1300)) * settings.creationSpeedModifier;
this.nextGen -= (1 * (this.nextGen/1300)) * settings.creationSpeedModifier;
}
}
};
@ -29,7 +39,7 @@ function waveGen(clock) {
this.ct++;
this.lastGen = this.dt;
var fv = randInt(0, MainClock.sides);
addNewBlock(fv, colors[randInt(0, colors.length)], 1.5 + (this.integerDifficulty/15) * 3);
addNewBlock(fv, colors[randInt(0, colors.length)], 1.3 + (this.integerDifficulty/15) * 3);
if (this.ct > 7) {
var nextPattern = randInt(0, 20 + 4);
if (nextPattern > 4 + 17) {
@ -52,12 +62,12 @@ function waveGen(clock) {
};
this.computeDifficulty = function() {
if (this.difficulty < 11) {
if (this.difficulty < 15) {
if (this.difficulty < 8) {
this.difficulty += (this.dt - this.last)/250000;
this.difficulty += (this.dt - this.last)/(1000000);
}
else {
this.difficulty += (this.dt - this.last)/5000000;
this.difficulty += (this.dt - this.last)/(20000000);
}
}
this.integerDifficulty = Math.floor(this.difficulty);
@ -166,11 +176,3 @@ function waveGen(clock) {
this.currentFunction = this.randomGeneration;
}
function generatorFunction() {
}
// In each generator function you need a few things
// Something defining when the next block is being generated
// Something defining which and when the next function is going to be passed