Code edit (1 edits merged)
Please save this source code
Code edit (22 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: center is not defined' in or related to this line: 'var instructionsTxt = new Text2('Welcome to space, traveler!\nTap to collect the color indicated below.', {' Line Number: 426
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Error: The supplied index is out of bounds' in or related to this line: 'game.setChildIndex(counter, game.children.length);' Line Number: 249
Code edit (9 edits merged)
Please save this source code
User prompt
can you update this line, so it updates the textlabel with the new value
Code edit (1 edits merged)
Please save this source code
Code edit (18 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: sel is not defined' in or related to this line: 'self.x = sel.x;' Line Number: 24
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: particleGraphics is not defined' in or related to this line: 'if (particleGraphics.alpha <= 0) {' Line Number: 247
Code edit (1 edits merged)
Please save this source code
Code edit (5 edits merged)
Please save this source code
User prompt
please implement it that way
Code edit (5 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: movetype is not defined' in or related to this line: 'if (movetype == 0) {' Line Number: 119
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (12 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -82,9 +82,9 @@
// This code block is removed to prevent redundancy in position updates.
// Reset star position and properties for smooth re-entry
//if (self.z > 2000 || self.x < -game.width || self.x > game.width * 2 || self.y < -game.height || self.y > game.height * 2) {
//if (self.x < -game.width || self.x > game.width * 2 || self.y < -game.height || self.y > game.height * 2) {
- if (self.x < 0 - self.width || self.x > game.width + self.width || self.y < 0 - self.height || self.y > game.height + self.height) {
+ if (self.z > 640000 || self.x < 0 - self.width || self.x > game.width + self.width || self.y < 0 - self.height || self.y > game.height + self.height) {
//self.z = Math.random() * 1900 + 100; // Reset Z to simulate continuous flow with varied depth
/*
self.z = 500;
self.x = (Math.random() - 0.5) * game.width * 2;
@@ -113,25 +113,32 @@
// Increment score.
score++;
scoreTxt.setText(score);
LK.setScore(score);
- if (++currentRightColor == currentPalette.length) {
+ // TODO: Particle effect?
+ if (++currentRightColor == currentPalette.length - 1) {
// Change to new palette.
allPalettesCounter++;
if (allPalettesCounter == allPalettes.length) {
allPalettesCounter = 0;
}
currentPalette = allPalettes[allPalettesCounter];
currentRightColor = 0;
+ game.setBackgroundColor(currentPalette[currentPalette.length - 1]);
+ initSquares();
selector.init(0);
+ stars.forEach(function (star, index) {
+ star.init();
+ });
} else {
- //TODO: Change to next color on palette.
+ // Move selector to next color on palette.
selector.init(currentRightColor);
}
// Re-init this star.
self.x = -50000;
} else {
console.log('wrong');
+ // TODO: Game over or life lost?
}
});
});
@@ -190,27 +197,32 @@
}();
var customColorsVibin = ["0xeffbf9", "0x0b152e", "0x194471", "0x1b7eb4", "0x11bbd9", "0x0f5434", "0x127d2c", "0x1a9f25", "0x60d12b", "0x162a2e", "0x2d4747", "0x3b6058", "0x577d6f", "0x13353b", "0x205858", "0x2d7d75", "0x57ab96", "0x67978c", "0x83b09c", "0xa9d5bb", "0xdbf2df", "0xbc5132", "0xd97840", "0xe29e3f", "0xfbca6b", "0xb03502", "0xcd6d07", "0xea9b06", "0xf2cc2c", "0x60212b", "0x8a331d", "0xb46d23", "0xd9a744", "0x64112a", "0x961b2d", "0xc02038", "0xf23a3a", "0x301d32", "0x6f1771", "0xbc1a8d", "0xf23e9a", "0x433933", "0x585047", "0x7d705c", "0x9b9172", "0x003a5c", "0x03668e", "0x0d8cb0", "0x18abc4", "0xd138a0", "0xea5699", "0xf78c9d", "0xfbb495", "0xa76372", "0xc98a9c", "0xe6acc1", "0xf2bed1", "0x16111d"];
var galacticGreen = ["0xe8f1a6", "0xcad670", "0xa3c255", "0x6fa341", "0x498f45", "0x387450", "0x2d5c56", "0x1f3741", "0x1e2029", "0x16161c"];
var berryNebula = ["0x6ceded", "0x6cb9c9", "0x6d85a5", "0x6e5181", "0x6f1d5c", "0x4f1446", "0x2e0a30", "0x0d001a"];
-var currentPalette = berryNebula;
-game.setBackgroundColor(currentPalette[currentPalette.length - 1]);
+var cyclope6 = ["0x30e1b9", "0x0eaf9b", "0x0b8a8f", "0x32535f", "0x631b34", "0x411d31"];
+var hotSand = ["0xf26d1f", "0xe04217", "0xc02b18", "0x7c0300", "0x590000", "0x3a0000"];
+//var currentPalette = berryNebula;
+//game.setBackgroundColor(currentPalette[currentPalette.length - 1]);
// Since game changes between palettes as we progress, we keep the different palettes in an array and have a counter for which one we're current using.
var allPalettesCounter = 0;
-var allPalettes = [berryNebula, galacticGreen];
+var allPalettes = [hotSand, cyclope6, berryNebula, galacticGreen];
+var currentPalette = allPalettes[allPalettesCounter];
+game.setBackgroundColor(currentPalette[currentPalette.length - 1]);
+// TODO: Add more palettes to game.
/*
-// Create a text label with a warning message
-var warningTxt = new Text2('Captain?! Please confirm order to keep accelerating!?\nWe are approaching very dangerous speeds!\nAnd where the HELL are we actually going?', {
+// Create a text label with instructions.
+var instructionsTxt = new Text2('Tap stars of the indicated color.\n', {
size: 75,
fill: "#ffffff",
anchorX: 0.5,
anchorY: 0.5,
align: 'center'
});
// Center the text label on the screen
-warningTxt.x = game.width / 2 - 900;
-warningTxt.y = game.height / 2;
+instructionsTxt.x = game.width / 2 - 900;
+instructionsTxt.y = game.height / 2;
// Add the text label to the game
-game.addChild(warningTxt);
+game.addChild(instructionsTxt);
*/
var centerX = 1024;
var centerY = game.height / 2;
var targetX = centerX;
@@ -218,12 +230,13 @@
var tweenDuration = 60; // 60 frames = 1 second at 60FPS
var tweenProgress = 0;
game.on('down', function (obj) {
var pos = obj.event.getLocalPosition(game);
- targetX = pos.x;
- targetY = pos.y;
+ //targetX = pos.x;
+ //targetY = pos.y;
tweenProgress = 0;
- //currentPalette = galacticGreen;
+ targetX = game.width - pos.x;
+ targetY = game.height - pos.y;
});
LK.on('tick', function () {
if (tweenProgress < tweenDuration) {
centerX += (targetX - centerX) / (tweenDuration - tweenProgress);
@@ -238,14 +251,29 @@
stars.push(star);
game.addChild(star);
}
var squares = [];
+var initSquares = function initSquares() {
+ // Start by removing squares from previous palette, if they exist.
+ squares.forEach(function (square, index) {
+ square.destroy();
+ });
+ squares = [];
+ for (var j = 0; j < currentPalette.length - 1; j++) {
+ var square = new Square();
+ square.init(j);
+ squares.push(square);
+ game.addChild(square);
+ }
+};
+/*
for (var j = 0; j < currentPalette.length - 1; j++) {
var square = new Square();
square.init(j);
squares.push(square);
game.addChild(square);
-}
+}*/
+initSquares();
var selector = new Selector();
selector.init(0);
game.addChild(selector);
var currentRightColor = 0;
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.