added fading to denote combo timeout

This commit is contained in:
Garrett Finucane 2014-06-23 17:59:51 -04:00
parent 8637950d12
commit 55684e9abd
4 changed files with 35 additions and 7 deletions

View file

@ -1,2 +0,0 @@
for file in $(find . -type f -name "*.js"); do touch filename2; grep -v "debugger\|console" $file > filename2; mv filename2 $file; done;

View file

@ -1,5 +1,6 @@
function Clock(sideLength) {
this.fillColor = '#2c3e50';
this.fillColor = [44,62,80];
this.tempColor = [44,62,80];
this.angularVelocity = 0;
this.position = 0;
this.dy = 0;
@ -127,7 +128,7 @@ function Clock(sideLength) {
};
this.draw = function() {
this.ct++;
this.ct++;
this.x = trueCanvas.width/2;
if (gameState != -2) {
@ -154,6 +155,34 @@ function Clock(sideLength) {
this.angle += this.angularVelocity;
}
drawPolygon(this.x + gdx, this.y + gdy + this.dy, this.sides, this.sideLength, this.angle, this.fillColor, 0, 'rgba(0,0,0,0)');
drawPolygon(this.x + gdx, this.y + gdy + this.dy, this.sides, this.sideLength, this.angle, arrayToColor(this.tempColor), 0, 'rgba(0,0,0,0)');
fadeTo(this);
};
}
function arrayToColor(arr){
return 'rgb(' + arr[0] + ',' + arr[1] + ',' + arr[2] + ')';
}
var subtracters=[];
function fadeTo(clock){
var temp = clock.tempColor;
var base = clock.fillColor;
if(clock.ct - clock.lastCombo == 1){
for(var i=0;i<3;i++){
if( base[i]>temp[i])
subtracters[i] = Math.ceil((base[i]-temp[i])/160);
if( base[i]<temp[i])
subtracters[i] = Math.floor((base[i]-temp[i])/160);
}
console.log(subtracters);
}
if(clock.ct - clock.lastCombo >= 160){
subtracters=[0,0,0];
clock.tempColor = clock.fillColor;
}
for(var i=0;i<3;i++){
if(temp[i] != base[i]) {
clock.tempColor[i] = clock.tempColor[i]+subtracters[i];
}
}
}

View file

@ -78,5 +78,6 @@ function consolidateBlocks(clock,side,index){
}
var adder = deleting.length * deleting.length * clock.comboMultiplier;
clock.texts.push(new Text(clock.x,clock.y,"+ "+adder.toString(),"bold Q 24px",deletedBlocks[0].color,fadeUpAndOut));
clock.tempColor = deletedBlocks[0].color.slice(4,-1).split(",").map(Number);
score += adder;
}

View file

@ -1,7 +1,7 @@
var colors = ["#e74c3c", "#f1c40f", "#3498db", "#2ecc71"];
var colors = ["rgb(231,76,60)", "rgb(241,196,15)", "rgb(52,152,219)", "rgb(46,204,113)"];
var hexagonBackgroundColor = 'rgb(236, 240, 241)';
var hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)';
var centerBlue = '#2c3e50'; //tumblr?
var centerBlue = 'rgb(44,62,80)'; //tumblr?
function renderText(x, y, fontSize, color, text) {
fontSize *= settings.scale;