From 6fb087226996b8cee01c7ddf81e7ad2925253817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Fri, 10 May 2019 09:25:15 +0900 Subject: [PATCH] Add: chocoball color --- src/game/mouse/one_to_fifty/chocoball.js | 33 +++++++++++++++++++++++- src/game/mouse/one_to_fifty/game.js | 4 +-- src/game/mouse/one_to_fifty/god.js | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/game/mouse/one_to_fifty/chocoball.js b/src/game/mouse/one_to_fifty/chocoball.js index 5ffd9f2..d780aa7 100644 --- a/src/game/mouse/one_to_fifty/chocoball.js +++ b/src/game/mouse/one_to_fifty/chocoball.js @@ -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; \ No newline at end of file diff --git a/src/game/mouse/one_to_fifty/game.js b/src/game/mouse/one_to_fifty/game.js index 21e7bb9..6c3971e 100644 --- a/src/game/mouse/one_to_fifty/game.js +++ b/src/game/mouse/one_to_fifty/game.js @@ -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); diff --git a/src/game/mouse/one_to_fifty/god.js b/src/game/mouse/one_to_fifty/god.js index 5d39fac..5f9095e 100644 --- a/src/game/mouse/one_to_fifty/god.js +++ b/src/game/mouse/one_to_fifty/god.js @@ -81,4 +81,4 @@ God.loadResources = function() { } God.POSITION_X = 840; -God.POSITION_Y = 640; \ No newline at end of file +God.POSITION_Y = 645; \ No newline at end of file