User prompt
create an object in elliptical orbit around secondPlanet
User prompt
Fix Bug: 'ReferenceError: satellite is not defined' in this line: 'if (satellite.intersects(ball)) {' Line Number: 158
User prompt
create an object in elliptical orbit around secondPlanet
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 124
User prompt
make a second satellite in an elliptical orbit around secondPlanet, call him SecondSatellite
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
make a second satellite in an elliptical orbit around secondPlanet, leave the old satellite unchanged
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
make a second satellite in an elliptical orbit around secondPlanet
User prompt
the first satellite is missing, fix it
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
make a second satellite in an elliptical orbit around secondPlanet, the ellipse of the orbit is directed upward and partially extends beyond the screen
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
make a second satellite in an elliptical orbit around the second planet, the orbit is directed upward and partially extends beyond the screen
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
Fix Bug: 'Uncaught ReferenceError: Satellite is not defined' in this line: 'var satellite = game.addChild(new Satellite());' Line Number: 125
User prompt
make a second satellite in an elliptical orbit around the second planet, the orbit is directed upward and partially extends beyond the screen
User prompt
increase gravity secondPlanet by 30 percent
User prompt
increase gravity secondPlanet by 50 percent
User prompt
increase gravity secondPlanet by 80 percent
User prompt
increase gravity secondPlanet by 50 percent
User prompt
increase gravity secondPlanet by 30 percent
User prompt
increase secondPlanet gravity by 30 percent
User prompt
increase planet two's gravity by 30 percent
User prompt
increase the gravity of the second planet by 30 percent
===================================================================
--- original.js
+++ change.js
@@ -60,26 +60,26 @@
self.radius = planetGraphics.width / 2;
self.x = game.width / 2 - 100;
self.y = game.height / 2 - 550; // Position the second planet above the first
});
-// EllipticalOrbiter class
-var EllipticalOrbiter = Container.expand(function () {
+// EllipticalOrbitObject class
+var EllipticalOrbitObject = Container.expand(function () {
var self = Container.call(this);
- var orbiterGraphics = self.createAsset('ellipticalOrbiter', 'Elliptical Orbiter asset', 0.5, 0.5);
+ var orbitObjectGraphics = self.createAsset('ellipticalOrbitObject', 'Elliptical Orbit Object asset', 0.5, 0.5);
self.orbitRadiusX = 0;
self.orbitRadiusY = 0;
self.orbitSpeed = 0.01;
self.orbitAngle = Math.random() * Math.PI * 2;
self.update = function (targetPlanet) {
self.orbitAngle += self.orbitSpeed;
- var dx = targetPlanet.x - self.orbitRadiusX * Math.cos(self.orbitAngle);
- var dy = targetPlanet.y - self.orbitRadiusY * Math.sin(self.orbitAngle);
- self.x = dx;
- self.y = dy;
+ var dx = targetPlanet.x - game.width / 2;
+ var dy = targetPlanet.y - game.height / 2;
+ self.x = targetPlanet.x + self.orbitRadiusX * Math.cos(self.orbitAngle);
+ self.y = targetPlanet.y + self.orbitRadiusY * Math.sin(self.orbitAngle);
};
self.reset = function (targetPlanet) {
self.orbitRadiusX = targetPlanet.radius * 2;
- self.orbitRadiusY = targetPlanet.radius;
+ self.orbitRadiusY = targetPlanet.radius * 1.5;
self.orbitSpeed = Math.random() * 0.02 + 0.005;
self.orbitAngle = Math.random() * Math.PI * 2;
};
});
@@ -116,11 +116,11 @@
rightPaddle.x = game.width - 100;
rightPaddle.y = game.height / 2;
var secondPlanet = game.addChild(new SecondPlanet());
ball.reset();
-// Initialize elliptical orbiter
-var ellipticalOrbiter = game.addChild(new EllipticalOrbiter());
-ellipticalOrbiter.reset(secondPlanet);
+// Initialize elliptical orbit object
+var ellipticalOrbitObject = game.addChild(new EllipticalOrbitObject());
+ellipticalOrbitObject.reset(secondPlanet);
// Game logic
LK.on('tick', function () {
ball.update();
leftPaddle.update();
@@ -152,14 +152,14 @@
ball.velocity.x += gravityX * (1 - (safeDistance - distance) / safeDistance);
ball.velocity.y += gravityY * (1 - (safeDistance - distance) / safeDistance);
}
});
- // Update elliptical orbiter orbit
- ellipticalOrbiter.update(secondPlanet);
- if (ellipticalOrbiter.intersects(ball)) {
+ // Update elliptical orbit object around secondPlanet
+ ellipticalOrbitObject.update(secondPlanet);
+ if (satellite.intersects(ball)) {
// Reflect ball velocity
- var normalX = ball.x - ellipticalOrbiter.x;
- var normalY = ball.y - ellipticalOrbiter.y;
+ var normalX = ball.x - satellite.x;
+ var normalY = ball.y - satellite.y;
var normalLength = Math.sqrt(normalX * normalX + normalY * normalY);
normalX /= normalLength;
normalY /= normalLength;
var dotProduct = ball.velocity.x * normalX + ball.velocity.y * normalY;
plasma barrier. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
neutron star. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
neutron star, pulsar. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cat eye nebula, cartoon style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
flying saucer, cartoon style. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
erase