Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: ball is not defined' in or related to this line: 'console.log('collision occurred: (obstacle:', t.radius, t.angle, t.x, t.y, ') , (player: ', ball.radius, ball.angle, ball.x, ball.y);' Line Number: 345
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: localToGlobal is not defined' in or related to this line: 'var globalPos1 = localToGlobal(object1);' Line Number: 271
Code edit (6 edits merged)
Please save this source code
User prompt
update the getglobalposition function to account for parent objects having been scaled up or down
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getChildAt')' in or related to this line: 'LK.effects.flashScreen(obstacles[i].parent.getChildAt(0).getTint(), 1000);' Line Number: 342
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getChildAt')' in or related to this line: 'LK.effects.flashScreen(obstacles[i].parent.getChildAt(0).tint, 1000);' Line Number: 342
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'orbitGraphics')' in or related to this line: 'LK.effects.flashScreen(obstacles[i].parent.orbitGraphics.tint, 1000);' Line Number: 342
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: barrier is not defined' in or related to this line: 'barrier.angle = 0;' Line Number: 170
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
===================================================================
--- original.js
+++ change.js
@@ -6,10 +6,8 @@
* Maybe player should change orbit direction (and/or speed) with the orbit he jumps into?
* Make sure orbits don't have too many obstacles.
* Maybe pause player and obstacle updating while scaling?
* Current min and max speeds of obstacles should be closer to each other.
-* Some orbits could contain a single powerup (static, so player would always be able to circle around and get it.)
-* Or maybe just orbits with no obstacles, as a breather.
* Make check of circular collision, considering actual display size and stage coordinates of obstacles. (Or even just a forgiving distanc check).
* Maybe background should tint with an offset on the colorwheel?
* Rotate orbits with obstacles statically distributed on them instead of calculating obstacle positions (for performance).
* Would also be cool to be able to jump in AND out of orbits, but hard to implement. Or maybe just tap on the orbit to go to?
@@ -86,9 +84,9 @@
anchorX: 0.5,
anchorY: 0.5
});
//self.angleSpeed = 0.01;
- self.orbitSpeed = 0;
+ self.orbitSpeed = 0.075;
self.move = function () {
self.radius = self.parent.width / 2 * (1900 / self.parent.width) - self.width / 2 * (100 / self.width) + 10;
self.angle = (self.angle || 0) + self.orbitSpeed;
self.x = self.radius * Math.cos(self.angle);
@@ -117,9 +115,9 @@
if (this.numBarriers > 12) {
this.numBarriers = 12;
}
// Add powerup to some orbits
- if ((i + currentOrbitIndex) % 6 == 0) {
+ if (orbitsCreated % 17 == 0) {
this.numBarriers = 0;
self.addPowerup(0);
}
//self.barrierSpeed = Math.random() * currentOrbitIndex + 1 / 20;
@@ -224,8 +222,9 @@
colors.push(hsvToHex(hue / 360, 1, 1));
}
return colors;
}();
+var powerup1Activated = false;
// Initialize player
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
@@ -270,8 +269,15 @@
}
});
LK.on('tick', function () {
player.update();
+ if (powerup1Activated) {
+ powerup1Activated = false;
+ for (var i = obstacles.length - 1; i > 0; i--) {
+ obstacles[i].destroy();
+ obstacles[i]._destroyed = true;
+ }
+ }
if (scaling) {
scalingCounter++;
for (var i = 0; i < orbits.length; i++) {
orbits[i].width += scalingSpeed;
@@ -328,10 +334,11 @@
if (player.intersects(obstacles[i])) {
if (obstacles[i] instanceof Powerup1) {
obstacles[i].destroy();
obstacles[i]._destroyed = true;
- //LK.effects.flashScreen(0x00ffff, 1000);
- LK.effects.flashScreen(rainbowColors[currentOrbitIndex], 1000);
+ LK.effects.flashScreen(0xffffff, 1000);
+ //LK.effects.flashScreen(rainbowColors[Math.floor(Math.random() * numColors)], 1000);
+ powerup1Activated = true;
} else {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}