Fix: click all chocolate
This commit is contained in:
@@ -18,22 +18,22 @@ Chocoball.prototype.initVariables = function(textContent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Chocoball.prototype.drawChocoball = function() {
|
Chocoball.prototype.drawChocoball = function() {
|
||||||
|
var sizeRatio = 0.6;
|
||||||
|
|
||||||
var x = Chocoball.getX(this.index);
|
var x = Chocoball.getX(this.index);
|
||||||
var y = Chocoball.getY(this.index);
|
var y = Chocoball.getY(this.index);
|
||||||
this.body = game.add.sprite(x, y, 'choco_body');
|
this.body = game.add.sprite(x, y, 'choco_body');
|
||||||
// this.body.scale.set(1);
|
this.body.scale.set(sizeRatio);
|
||||||
this.body.anchor.set(0.5);
|
this.body.anchor.set(0.5);
|
||||||
|
|
||||||
this.body.inputEnabled = true;
|
this.body.inputEnabled = true;
|
||||||
this.body.events.onInputDown.add(this.onClick, this);
|
this.body.events.onInputDown.add(this.onClick, this);
|
||||||
|
|
||||||
|
|
||||||
this.numberText = this.makeNumber("");
|
this.numberText = this.makeNumber("");
|
||||||
this.body.addChild(this.numberText);
|
this.body.addChild(this.numberText);
|
||||||
|
|
||||||
this.gloss = game.add.sprite(x, y, 'choco_gloss');
|
this.gloss = game.add.sprite(0, 0, 'choco_gloss');
|
||||||
// this.gloss.scale.set(1);
|
|
||||||
this.gloss.anchor.set(0.5);
|
this.gloss.anchor.set(0.5);
|
||||||
|
this.body.addChild(this.gloss);
|
||||||
}
|
}
|
||||||
|
|
||||||
Chocoball.prototype.makeNumber = function(numberText) {
|
Chocoball.prototype.makeNumber = function(numberText) {
|
||||||
@@ -93,14 +93,14 @@ Chocoball.getX = function(index) {
|
|||||||
if(index == 100)
|
if(index == 100)
|
||||||
return 840;
|
return 840;
|
||||||
|
|
||||||
return 200 + (index % 5) * 100;
|
return 250 + (index % 5) * 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chocoball.getY = function(index) {
|
Chocoball.getY = function(index) {
|
||||||
if(index == 100)
|
if(index == 100)
|
||||||
return 285;
|
return 285;
|
||||||
|
|
||||||
return 200 + (Math.floor(index / 5)) * 100;
|
return 250 + (Math.floor(index / 5)) * 70;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chocoball.loadResources = function() {
|
Chocoball.loadResources = function() {
|
||||||
@@ -115,20 +115,20 @@ Chocoball.IMAGE_SIZE = 90;
|
|||||||
Chocoball.IMAGE_CENTER = Chocoball.IMAGE_SIZE / 2;
|
Chocoball.IMAGE_CENTER = Chocoball.IMAGE_SIZE / 2;
|
||||||
|
|
||||||
Chocoball.FONT_STYLE = {
|
Chocoball.FONT_STYLE = {
|
||||||
font: "40px Arial",
|
font: "50px Arial",
|
||||||
boundsAlignH: "center", // left, center. right
|
boundsAlignH: "center", // left, center. right
|
||||||
boundsAlignV: "middle", // top, middle, bottom
|
boundsAlignV: "middle", // top, middle, bottom
|
||||||
fill: "#fff",
|
fill: "#fff",
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
stroke: "rgba(0, 0, 0, 0.5)", // "#333", // "#000",
|
stroke: "rgba(0, 0, 0, 0.5)", // "#333", // "#000",
|
||||||
strokeThickness: 8,
|
strokeThickness: 12,
|
||||||
align: "center"
|
align: "center"
|
||||||
};
|
};
|
||||||
|
|
||||||
Chocoball.DEFAULT_TEXT_LINE_SPACING_PX = -10; // in pixel
|
Chocoball.DEFAULT_TEXT_LINE_SPACING_PX = -10; // in pixel
|
||||||
Chocoball.DEFAULT_STROKE_WIDTH_PX = 5; // in pixel
|
Chocoball.DEFAULT_STROKE_WIDTH_PX = 5; // in pixel
|
||||||
|
|
||||||
Chocball.RADIUS = 90;
|
Chocoball.RADIUS = 90;
|
||||||
|
|
||||||
Chocoball.COLOR_BLACK = 0x553333;
|
Chocoball.COLOR_BLACK = 0x553333;
|
||||||
Chocoball.COLOR_1_TO_10 = 0x3355ff;
|
Chocoball.COLOR_1_TO_10 = 0x3355ff;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ var Game = {
|
|||||||
|
|
||||||
drawObjects: function() {
|
drawObjects: function() {
|
||||||
var graphics = game.add.graphics(0, 0);
|
var graphics = game.add.graphics(0, 0);
|
||||||
var outLineRadius = 97;
|
var outLineRadius = 64;
|
||||||
|
|
||||||
this.chocoballs = new Array();
|
this.chocoballs = new Array();
|
||||||
for(var i = 0; i < 25; i++) {
|
for(var i = 0; i < 25; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user