Code edit (7 edits merged)
Please save this source code
User prompt
when player taps, remove the instructiontext from gui
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: center is not defined' in or related to this line: 'var instructionText = new Text2('Tap to jump to the next orbit.\nDon\'t hit the red obstacles.', {' Line Number: 227
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'gui')' in or related to this line: 'scoreTxt.LK.gui.top.addChild(scoreTxt);' Line Number: 216
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'bottom')' in or related to this line: 'LK.top.bottom.addChild(instructionText);' Line Number: 236
Code edit (6 edits merged)
Please save this source code
User prompt
make sure instructionscreen is visible on stage at start
Code edit (1 edits merged)
Please save this source code
Code edit (19 edits merged)
Please save this source code
User prompt
At start, display white instruction text at screen bottom: "Tap to jump to the next orbit. Don't hit the red obstacles."
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'backgroundColor')' in or related to this line: 'game.set.backgroundColor = rainbowColors[12];' Line Number: 224
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'parent')' in or related to this line: 'if (obstacles[i].parent) {' Line Number: 276
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'parent')' in or related to this line: 'if (obstacles[i].parent) {' Line Number: 276
Code edit (4 edits merged)
Please save this source code
User prompt
modify ranbowcolors function to only create an array of 30 evenly distributed colors on a seamless rainbow
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'Uncaught ReferenceError: i is not defined' in or related to this line: 'var orbitGraphics = self.attachAsset('orbit1', {' Line Number: 89
===================================================================
--- original.js
+++ change.js
@@ -2,13 +2,17 @@
* Classes
****/
/****
TODO:
-* Make sure that obstacles array, which holds references to obstacles in removed orbits, is regularly emptied of those.
* Make sure obstacles can't spawn directly on player angle with same speed at start, making first jump impossible.
-* Maybe player should change orbit direction with the orbit he jumps into?
+* Maybe player should change orbit direction (and/or speed) with the orbit he jumps into?
* Make sure orbits don't have too many obstacles (as currently possible).
* Maybe pause player and obstacle updating while scaling?
+* Maybe make jumping faster to allow faster consecutive jumps.
+* Current min and max speeds of obstacles should be closer to each other.
+* Some rings could contain a single powerup (static, so player would always be able to circle around and get it.)
+* Or maybe just no obstacles, as a breather.
+* Every play should start at a different index of the rainbow color wheel.
****/
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
@@ -177,9 +181,9 @@
colors.push(hsvToHex(hue / 360, 1, 1));
}
return colors;
}();
-console.log(rainbowColors);
+//console.log(rainbowColors);
// Initialize assets used in this game.
// Game variables
var player;
var orbits = [];
@@ -255,9 +259,18 @@
}
// Update orbits
for (var i = orbits.length - 1; i > 0; i--) {
//orbits[i].positionOrbit(i);
- if (orbits[i] && orbits[i].width > 2700) {
+ var orb = orbits[i];
+ //if (orb && orb.width > 2700) {
+ if (orb && orb.width > 3500) {
+ for (var j = 0; j < orb.children.length; j++) {
+ var child = orb.children[j];
+ if (child instanceof Obstacle) {
+ // child is an instance of YourClass, do something with it
+ child._destroyed = true;
+ }
+ }
orbits[i].destroy();
// Splice alters jump logic, so alter currentTargetOrbit too.
orbits.splice(i, 1);
currentOrbitIndex--;
@@ -267,12 +280,13 @@
for (var i = obstacles.length - 1; i > 0; i--) {
if (obstacles[i] && !obstacles[i]._destroyed) {
obstacles[i].move();
if (player.intersects(obstacles[i])) {
- //LK.effects.flashScreen(0xff0000, 1000);
- //LK.showGameOver();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
} else {
obstacles.splice(i, 1);
+ //console.log('obstacles.length is now: ' + obstacles.length);
}
}
});
\ No newline at end of file