Code edit (2 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.getSOund is not a function' in or related to this line: 'LK.getSOund('planet1').play();' Line Number: 348
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: LK.flashObject is not a function' in or related to this line: 'LK.flashObject(0xffffff);' Line Number: 92
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'LK.playSound is not a function' in or related to this line: 'LK.playSound('hyper1');' Line Number: 343
Code edit (11 edits merged)
Please save this source code
User prompt
play bgsound at start, and loop it when it finishes
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -250,8 +250,12 @@
// Increment score.
score++;
scoreTxt.setText(score);
LK.setScore(score);
+ if (score > storage.bestScore) {
+ storage.bestScore = score;
+ bestScoreTxt.setText('Best Score\n' + score);
+ }
collection.push({
w: self.width,
c: currentPalette[currentRightColor]
});
@@ -319,9 +323,12 @@
/****
* Game Code
****/
-// Function to create radial particle explosion
+// Play background sound at start and loop it
+LK.playMusic('bgSound', {
+ loop: true
+});
function createRadialExplosion(x, y) {
var numParticles = 20;
//var particles = [];
for (var i = 0; i < numParticles; i++) {
@@ -435,8 +442,9 @@
//instructionsTxt.destroy();
instructionsTxt.setText('');
gameLogo.destroy();
scoreTxt.alpha = 1;
+ bestScoreTxt.alpha = 1;
} else {
var pos = game.toLocal(obj.global);
//targetX = pos.x;
//targetY = pos.y;
@@ -527,9 +535,9 @@
game.addChild(goText);
var gLogo = game.addChild(new GameLogo());
gLogo.scale.x = 0.2;
gLogo.scale.y = 0.2;
- gLogo.x = game.width - 50 - gLogo.width / 2;
+ gLogo.x = 300 + gLogo.width / 2; //game.width - 50 - gLogo.width / 2;
gLogo.y = 50 + gLogo.height / 2;
//TODO: add game over button here
var b = game.addChild(new GameOverButton());
b.x = game.width - 50 - b.width / 2;
@@ -568,16 +576,17 @@
anchorX: 0.5
});
scoreTxt.alpha = 0;
LK.gui.top.addChild(scoreTxt);
-var bestScoreTxt = new Text2('Best Score:\n0', {
- weight: 800,
- size: 60,
+var bestScoreTxt = new Text2('Best Score\n' + storage.bestScore, {
+ weight: 300,
+ size: 45,
fill: 0xFFFFFF,
- anchorX: 0.5
+ anchorX: 0.5,
+ align: 'center'
});
-bestScoreTxt.alpha = 1;
-bestScoreTxt.x = -150;
+bestScoreTxt.alpha = 0;
+bestScoreTxt.x = -250;
LK.gui.topRight.addChild(bestScoreTxt);
var gameLogo = game.addChild(new GameLogo());
gameLogo.x = game.width / 2;
gameLogo.y = 700;
A white triangle pointing down.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A colorful rectangular button with the text "Play Again" with each letter in a different color picked from a nice palette.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.