Fix: chocoball slot
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
var Game = {
|
||||
|
||||
create: function() {
|
||||
this.mode = "release"; // "test";
|
||||
this.initVariables();
|
||||
|
||||
this.dbConnectManager = new DBConnectManager();
|
||||
@@ -48,8 +49,6 @@ var Game = {
|
||||
},
|
||||
|
||||
initVariables: function() {
|
||||
this.mode = "test";
|
||||
|
||||
this.nextNumber = 1;
|
||||
|
||||
this.difficulty = Chocoball.MODE_DIFFICULT;
|
||||
@@ -66,8 +65,16 @@ var Game = {
|
||||
},
|
||||
|
||||
drawObjects: function() {
|
||||
var graphics = game.add.graphics(0, 0);
|
||||
var outLineRadius = 97;
|
||||
|
||||
this.chocoballs = new Array();
|
||||
for(var i = 0; i < 25; i++) {
|
||||
graphics.lineStyle(0);
|
||||
graphics.beginFill(0x202020);
|
||||
graphics.drawCircle(Chocoball.getX(i), Chocoball.getY(i), outLineRadius);
|
||||
graphics.endFill();
|
||||
|
||||
var chocoball = new Chocoball(
|
||||
i,
|
||||
this.difficulty,
|
||||
@@ -77,7 +84,6 @@ var Game = {
|
||||
this.chocoballs.push(chocoball);
|
||||
}
|
||||
|
||||
var graphics = game.add.graphics(0, 0);
|
||||
var triangleStartX = God.POSITION_X;
|
||||
var triangleStartY = God.POSITION_Y - 245;
|
||||
var triangleHalfWidth = 20;
|
||||
@@ -132,37 +138,34 @@ var Game = {
|
||||
onClickChocoball: function(chocoball) {
|
||||
// console.log(chocoball.index);
|
||||
// console.log(chocoball.number);
|
||||
|
||||
if(chocoball.number == 1)
|
||||
this.stopWatch.start();
|
||||
|
||||
if(chocoball.number == this.nextNumber) {
|
||||
this.nextNumber++;
|
||||
this.god.animateHappy();
|
||||
} else {
|
||||
if(chocoball.number == 50) {
|
||||
// console.log("game clear");
|
||||
chocoball.setVisible(false);
|
||||
this.gameClear();
|
||||
return;
|
||||
}
|
||||
if(chocoball.number != this.nextNumber) {
|
||||
console.log("wrong");
|
||||
this.god.animateAngry();
|
||||
return;
|
||||
}
|
||||
|
||||
if(chocoball.number < 25) {
|
||||
// clicked correct number
|
||||
if(chocoball.number == 1)
|
||||
this.stopWatch.start();
|
||||
|
||||
this.nextNumber++;
|
||||
this.god.animateHappy();
|
||||
|
||||
if(chocoball.number <= 25)
|
||||
chocoball.setNumber(this.secondChocoballArray[chocoball.index]);
|
||||
this.nextChocoball.setNumber(this.nextNumber);
|
||||
} else {
|
||||
else
|
||||
chocoball.setVisible(false);
|
||||
}
|
||||
this.nextChocoball.setNumber(this.nextNumber);
|
||||
|
||||
if(this.mode == "test") {
|
||||
if(this.nextNumber == 3) {
|
||||
console.log("time over");
|
||||
this.timeOver();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(chocoball.number == 50) {
|
||||
console.log("game clear");
|
||||
this.gameClear();
|
||||
if(this.mode == "test" && this.nextNumber == 3) {
|
||||
console.log("time over");
|
||||
this.timeOver();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user