Merge branch 'gh-pages' of https://github.com/teamsnowman/hextris into gh-pages
This commit is contained in:
commit
70f1226c48
3 changed files with 8 additions and 15 deletions
11
js/Text.js
11
js/Text.js
|
@ -6,18 +6,11 @@ function Text(x,y,text,font,color,incrementFunction){
|
|||
this.opacity =1;
|
||||
this.text = text;
|
||||
this.alive=1;
|
||||
|
||||
this.draw = function(){
|
||||
if(this.alive>0){
|
||||
ctx.save();
|
||||
var sf = (settings.scale - 1)/3 + 1;
|
||||
ctx.scale(sf, sf);
|
||||
ctx.font= this.font;
|
||||
ctx.fillStyle = this.color;
|
||||
ctx.globalAlpha = this.opacity;
|
||||
ctx.fillText(this.text,(this.x + gdx) * (1/sf), (this.y + gdy) * (1/sf));
|
||||
renderText((this.x + gdx), (this.y + gdy),36,this.color,this.text);
|
||||
ctx.globalAlpha =1;
|
||||
ctx.restore();
|
||||
incrementFunction(this);
|
||||
return true;
|
||||
}
|
||||
|
@ -31,4 +24,4 @@ function fadeUpAndOut(text){
|
|||
text.opacity -= Math.pow(Math.pow((1-text.opacity), 1/3)+1,3)/100;
|
||||
text.alive = text.opacity;
|
||||
text.y-=3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,14 +70,14 @@ function consolidateBlocks(clock,side,index){
|
|||
clock.comboMultiplier += 1;
|
||||
clock.lastCombo = now;
|
||||
var coords = findCenterOfBlocks(deletedBlocks);
|
||||
clock.texts.push(new Text(coords['x'],coords['y'],"x "+clock.comboMultiplier.toString(),"bold Q 24px","#fff",fadeUpAndOut));
|
||||
clock.texts.push(new Text(coords['x'],coords['y'],"x "+clock.comboMultiplier.toString(),"bold Q","#fff",fadeUpAndOut));
|
||||
}
|
||||
else{
|
||||
clock.lastCombo = now;
|
||||
clock.comboMultiplier = 1;
|
||||
}
|
||||
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.texts.push(new Text(clock.x,clock.y,"+ "+adder.toString(),"bold Q ",deletedBlocks[0].color,fadeUpAndOut));
|
||||
clock.lastColorScored = deletedBlocks[0].color;
|
||||
score += adder;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ function render() {
|
|||
}
|
||||
|
||||
MainClock.draw();
|
||||
if (gameState ==1 || gameState ==-1 || gameState === 0) {
|
||||
drawScoreboard();
|
||||
}
|
||||
if (gameState ==1 || gameState ==-1 || gameState === 0) {
|
||||
drawScoreboard();
|
||||
}
|
||||
|
||||
for (i = 0; i < MainClock.texts.length; i++) {
|
||||
var alive = MainClock.texts[i].draw();
|
||||
|
@ -101,4 +101,4 @@ function drawKey(key, x, y) {
|
|||
}
|
||||
|
||||
ctx.restore();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue