Add: chocoball color

This commit is contained in:
2019-05-10 09:25:15 +09:00
parent 668dfd49fa
commit 6fb0872269
3 changed files with 35 additions and 4 deletions
+32 -1
View File
@@ -17,7 +17,7 @@ Chocoball.prototype.initVariables = function(textContent) {
if(this.index == 100) {
this.col = 6.4;
this.row = 1;
this.row = 0.85;
} else {
this.row = Math.floor(this.index / 5);
this.col = this.index % 5;
@@ -59,6 +59,27 @@ Chocoball.prototype.makeNumber = function(numberText) {
Chocoball.prototype.setNumber = function(number) {
this.number = number;
this.numberText.text = number;
this.setBodyColor(this.number, Chocoball.MODE_EASY);
}
Chocoball.prototype.setBodyColor = function(number, mode) {
if(mode == Chocoball.MODE_DIFFICULT) {
this.body.tint = Chocoball.COLOR_BLACK;
return;
}
if(number < 11)
this.body.tint = Chocoball.COLOR_1_TO_10;
else if(number < 21)
this.body.tint = Chocoball.COLOR_11_TO_20;
else if(number < 31)
this.body.tint = Chocoball.COLOR_21_TO_30;
else if(number < 41)
this.body.tint = Chocoball.COLOR_31_TO_40;
else
this.body.tint = Chocoball.COLOR_41_TO_50;
}
@@ -98,3 +119,13 @@ Chocoball.FONT_STYLE = {
Chocoball.DEFAULT_TEXT_LINE_SPACING_PX = -10; // in pixel
Chocoball.DEFAULT_STROKE_WIDTH_PX = 5; // in pixel
Chocoball.COLOR_BLACK = 0x553333;
Chocoball.COLOR_1_TO_10 = 0x3355ff;
Chocoball.COLOR_11_TO_20 = 0xff5533;
Chocoball.COLOR_21_TO_30 = 0x33ff55;
Chocoball.COLOR_31_TO_40 = 0xffff33;
Chocoball.COLOR_41_TO_50 = 0x33ffff;
Chocoball.MODE_EASY = 0;
Chocoball.MODE_DIFFICULT = 1;
+2 -2
View File
@@ -66,7 +66,7 @@ var Game = {
var graphics = game.add.graphics(0, 0);
var triangleStartX = God.POSITION_X;
var triangleStartY = God.POSITION_Y - 220;
var triangleStartY = God.POSITION_Y - 245;
var triangleHalfWidth = 20;
var triangleHeight = 40;
graphics.beginFill(0xFFFFFF);
@@ -79,7 +79,7 @@ var Game = {
graphics.lineStyle(10, 0x000000);
graphics.beginFill(0xFFFFFF);
graphics.drawCircle(God.POSITION_X, God.POSITION_Y - 340, 200);
graphics.drawCircle(God.POSITION_X, God.POSITION_Y - 360, 200);
graphics.endFill();
graphics.beginFill(0xFFFFFF);
+1 -1
View File
@@ -81,4 +81,4 @@ God.loadResources = function() {
}
God.POSITION_X = 840;
God.POSITION_Y = 640;
God.POSITION_Y = 645;