Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Uncaught ReferenceError: rainbowGraphics is not defined' in or related to this line: 'rainbowGraphics.tint = '0xffffff';' Line Number: 59
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'Timeout.tick error: Cannot read properties of null (reading 'alpha')' in or related to this line: 'powerupText.alpha -= 1 / fadeStep;' Line Number: 248
User prompt
Fix Bug: 'Timeout.tick error: LK.effects.fadeOut is not a function' in or related to this line: 'LK.effects.fadeOut(powerupText, 3000, function () {' Line Number: 243
User prompt
Fix Bug: 'Timeout.tick error: LK.effects.fadeObject is not a function' in or related to this line: 'LK.effects.fadeObject(powerupText, 0, 3000, function () {' Line Number: 243
User prompt
Fix Bug: 'Timeout.tick error: LK.effects.fadeOut is not a function' in or related to this line: 'LK.effects.fadeOut(powerupText, 3000, function () {' Line Number: 243
User prompt
once added in showpoweruptext, poweruptext should fade out over the course of 3 seconds
Code edit (2 edits merged)
Please save this source code
User prompt
make poweruptext disappear on click, if it exists
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -238,42 +238,8 @@
orbits.push(orbit);
}
}
createOrbits();
-function getGlobalPosition(object) {
- var position = {
- x: object.x,
- y: object.y
- };
- var parent = object.parent;
- var scale = {
- x: 1900 / parent.width,
- y: 1900 / parent.height
- };
- while (parent) {
- position.x = position.x * scale.x + parent.x;
- position.y = position.y * scale.y + parent.y;
- scale.x *= parent.scaleX || 1;
- scale.y *= parent.scaleY || 1;
- parent = parent.parent;
- }
- return position;
-}
-function calculateDistance(object1, object2) {
- var globalPos1 = getGlobalPosition(object1);
- var globalPos2 = getGlobalPosition(object2);
- var dx = globalPos1.x - globalPos2.x;
- var dy = globalPos1.y - globalPos2.y;
- return Math.sqrt(dx * dx + dy * dy);
-}
-function radIntersects(a, b, m) {
- /*
- var dx = (a.x - b.x) * (a.x - b.x);
- var dy = (a.y - b.y) * (a.y - b.y);
- return dx + dy < m * m;*/
- var dist = calculateDistance(a, b);
- return dist < m ? true : false;
-}
// Add instruction text at the bottom of the screen
var instructionText = new Text2('Tap to jump to the next orbit.\nDon\'t hit the red obstacles.', {
size: 50,
fill: "#bbbbbb",
@@ -364,10 +330,12 @@
// Update obstacles
for (var i = obstacles.length - 1; i > 0; i--) {
if (obstacles[i] && !obstacles[i]._destroyed) {
obstacles[i].move();
- //if (player.intersects(obstacles[i])) {
- if (radIntersects(player, obstacles[i], 100)) {
+ if (player.intersects(obstacles[i])) {
+ var t = obstacles[i];
+ console.log('collision occurred: (obstacle:', t.radius, t.angle, t.x, t.y, ') , (player: ', player.radius, player.angle, player.x, player.y);
+ //if (radIntersects(player, obstacles[i], 100)) {
if (obstacles[i] instanceof Powerup1) {
obstacles[i].destroy();
obstacles[i]._destroyed = true;
LK.effects.flashScreen(0xffffff, 1000);