===================================================================
--- original.js
+++ change.js
@@ -31,11 +31,13 @@
});
var Countdown = Container.expand(function () {
var self = Container.call(this);
var countdownLabel = new Text2('', {
- size: 150,
+ size: 300,
fill: '#ffffff',
- font: 'Impact'
+ font: 'Impact',
+ stroke: '#000000',
+ strokeThickness: 15
});
countdownLabel.anchor.set(.5, .5);
self.addChild(countdownLabel);
self.x = 2048 / 2;
@@ -44,15 +46,28 @@
var countdownTexts = ['Ready', 'Set', 'Go'];
var index = 0;
countdownLabel.setText(countdownTexts[index]);
var countdownInterval = LK.setInterval(function () {
- if (index >= countdownTexts.length) {
+ if (index >= countdownTexts.length - 1) {
LK.clearInterval(countdownInterval);
self.destroy();
+ return;
}
+ self.scale.set(1, 1);
+ LK.getSound('countdown').play();
index++;
- }, 1000);
+ countdownLabel.setText(countdownTexts[index]);
+ }, 700);
+ LK.setTimeout(function () {
+ gameStarted = true;
+ }, 1500);
+ LK.getSound('countdown').play();
};
+ self.update = function () {
+ var ns = self.scale.x;
+ ns *= .99;
+ self.scale.set(ns, ns);
+ };
});
var OverhangPlate = Container.expand(function (width, direction, color) {
var self = Container.call(this);
var plateGraphics = self.attachAsset('plate', {
@@ -229,18 +244,18 @@
plates.push(newPlate);
plateContainer.addChild(newPlate);
var bonusCount = 1;
game.on('down', function (x, y, obj) {
- if (!gameStarted || countdown.parent) {
+ if (!gameStarted) {
return;
}
var topPlate = plates[plates.length - 2];
if (newPlate.x < topPlate.x + topPlate.width && newPlate.x + newPlate.width > topPlate.x) {
var overhang = newPlate.x + newPlate.width / 2 - (topPlate.x + topPlate.width / 2);
var overhangSide = overhang > 0 ? 'right' : 'left';
overhang = Math.abs(overhang);
newPlate.stack();
- if (overhang > 21) {
+ if (overhang > 22) {
bonusCount = 1;
LK.getSound('place').play();
currentPlateWidth -= overhang;
var overhangPlate = new OverhangPlate(overhang, overhangSide, newPlate.color);
@@ -263,9 +278,9 @@
plateColorIndex++;
nextPlate.colorIndex = plateColorIndex;
nextPlate.updateColor();
plates.push(nextPlate);
- if (overhang <= 21) {
+ if (overhang <= 22) {
newPlate.x = topPlate.x;
LK.getSound('perfect').play();
bonusCount++;
var bonusIndicator = new BonusIndicator('+' + bonusCount, newPlate.color);
@@ -280,10 +295,10 @@
scoreTxt.setText(newScore);
LK.setScore(newScore);
newPlate = nextPlate;
} else {
- LK.showGameOver();
LK.getSound('gameover').play();
+ LK.showGameOver();
}
});
var countdown = new Countdown();
game.addChild(countdown);
@@ -299,8 +314,9 @@
if (plate instanceof OverhangPlate && (plate.x < -plate.width / 2 || plate.x > 2048 + plate.width / 2 || plate.y > 2732 + plate.height / 2)) {
plate.destroy();
}
if (newPlate.x < -newPlate.width / 2) {
+ LK.getSound('gameover').play();
LK.showGameOver();
}
var topPlate = plates[plates.length - 2];
if (newPlate.x < topPlate.x + topPlate.width && !newPlate.hasOverlapped) {