Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'alpha')' in or related to this line: 'score.text.alpha = 0;' Line Number: 468
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (8 edits merged)
Please save this source code
User prompt
please write that function as a standalone function to be called from within the star's current move function
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -41,8 +41,15 @@
LK.showGameOver();
}
};
});
+var GameLogo = Container.expand(function () {
+ var self = Container.call(this);
+ var logoGraphics = self.attachAsset('gameLogo', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+});
// Particle class for explosion effect
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleGraphics = self.attachAsset('star', {
@@ -114,10 +121,13 @@
//console.log(self.tint);
// Initialize star position closer to the center for a 3D effect
//self.z = Math.random() * 1900 + 100; // Adjusted Z position range to prevent very small values
self.z = 5000;
- self.x = (Math.random() - 0.5) * game.width * 2;
- self.y = (Math.random() - 0.5) * game.height * 2;
+ //self.x = (Math.random() - 0.5) * game.width * 2;
+ self.x = 100 + Math.random() * (game.width - 100);
+ //self.y = (Math.random() - 0.5) * game.height * 2;
+ //self.y = Math.random() * game.height;
+ self.y = 100 + Math.random() * (game.height - 100);
self.vx = (self.x - centerX) / self.z;
self.vy = (self.y - centerY) / self.z;
starGraphics.tint = currentPalette[Math.floor(Math.random() * (currentPalette.length - 1))];
};
@@ -173,9 +183,13 @@
} else {
self.y = centerY + self.vy * self.z;
}*/
var moveType = allPalettesCounter % 5;
- if (moveType == 4) {
+ //var moveType = (movementTypeSelectorOffset + allPalettesCounter) % 5;
+ /*if (currentPalette == matriax8c && score != 0) {
+ moveType == 3;
+ }*/
+ if (moveType == 0) {
self.x = centerX + self.vx * self.z;
self.y = centerY + self.vy * self.z;
} else if (moveType == 1) {
self.x = centerX + self.vx * self.z;
@@ -185,9 +199,9 @@
self.y = centerY + self.vy * self.z;
} else if (moveType == 3) {
self.x = centerX + Math.sin(self.z / 10000) * self.vx * self.z;
self.y = centerY + Math.cos(self.z / 10000) * self.vy * self.z;
- } else if (moveType == 0) {
+ } else if (moveType == 4) {
// Calculate the direction vector from the center to the star
var dx = self.x - centerX;
var dy = self.y - centerY;
// Normalize the direction vector
@@ -196,10 +210,10 @@
dy /= length;
// Adjust velocity to create a spiraling effect
//self.vx += dy * 0.4; // Adjust the 0.05 value to control the tightness of the spiral
//self.vy -= dx * 0.4; // Adjust the 0.05 value to control the tightness of the spiral
- self.vx += dy * 0.4 * 5000 / self.z; // Adjust the 0.05 value to control the tightness of the spiral
- self.vy -= dx * 0.4 * 5000 / self.z; // Adjust the 0.05 value to control the tightness of the spiral
+ self.vx += dy * 0.4 * 7500 / self.z; // Adjust the 0.05 value to control the tightness of the spiral
+ self.vy -= dx * 0.4 * 7500 / self.z; // Adjust the 0.05 value to control the tightness of the spiral
// Update position based on velocity
self.x += self.vx;
self.y += self.vy;
} else {
@@ -237,8 +251,18 @@
selector.init(0);
stars.forEach(function (star, index) {
star.init();
});
+ // Every once in a while, we'll decrement the countdown timer to increase difficulty.
+ if (score > 44 && score < 80) {
+ counterMax--;
+ } else if (score > 89 && score < 130) {
+ counterMax--;
+ } else if (score > 134 && score < 170) {
+ counterMax--;
+ } else if (score > 179 && counterMax > 6) {
+ counterMax--;
+ }
} else {
// Move selector to next color on palette.
selector.init(currentRightColor);
}
@@ -339,16 +363,17 @@
var superNova7 = ["0xffce9c", "0xcf7862", "0xa75252", "0x773a4d", "0x543246", "0x1a080e"];
//var cyclope6 = ["0x30e1b9", "0x0eaf9b", "0x0b8a8f", "0x32535f", "0x631b34", "0x411d31"];
var cyclope6 = ["0x52f3db", "0x0eaf6b", "0x0b8a8f", "0x32535f", "0x631b34", "0x300d21"];
//var hotSand = ["0xf26d1f", "0xe04217", "0xc02b18", "0x7c0300", "0x590000", "0x3a0000"];
-var hotSand = ["0xf3b93e", "0xf26d1f", "0xe04217", "0xc02b18", "0x7c0300", "0x290000"];
+var hotSand = ["0xf3b93e", "0xf26d1f", "0xe04217", "0xa92616", "0x7c0300", "0x290000"];
//var pinkNeonSign6 = ["0xef87c3", "0xcc77af", "0x9e6695", "0x70567b", "0x51496b", "0x313d59"];
var pinkNeonSign6 = ["0xffe8e3", "0xef97c3", "0xbb66af", "0x8e5685", "0x932a6f", "0x313d59"];
//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 = [vividMemory8, berryNebula, superNova7, matriax8c, pinkNeonSign6, hotSand, cyclope6, galacticGreen];
+var allPalettesCounter = 0; //Math.floor(Math.random() * allPalettes.length);
+//var movementTypeSelectorOffset = 5 - allPalettesCounter; //-1 * allPalettesCounter;
var currentPalette = allPalettes[allPalettesCounter];
game.setBackgroundColor(currentPalette[currentPalette.length - 1]);
// TODO: Add more palettes to game.
/*
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.