Code edit (5 edits merged)
Please save this source code
User prompt
convert the winningMessage into a WinningMessage class
Code edit (1 edits merged)
Please save this source code
User prompt
After setting the winningTime display a BorderedText message at the bottom of the screen that says: "Congratulations, you win!\nYou reached the gold planet in: " + winningTime
Code edit (1 edits merged)
Please save this source code
User prompt
After setting the winningTick, convert the winningTick into hours, minutes and seconds
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: button is not defined' in this line: 'button[0].addChild(crosshair);' Line Number: 304
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: PLANET_RADIUS_GOLD is not defined' in this line: 'var self = Planet.call(this, x, y, PLANET_RADIUS_GOLD, 'planetGold');' Line Number: 221
User prompt
Add a new PlanetGold class that has a cost of 3000 after the PlanetOmni class
Code edit (4 edits merged)
Please save this source code
User prompt
When calling transitionPlanets flash the screen black
Code edit (12 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: NAVIGATION[currentPlanet] is not a constructor' in this line: 'planet = planets[currentPlanet] = new NAVIGATION[currentPlanet](GAME_WIDTH / 2, GAME_HEIGHT / 2);' Line Number: 416
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: crosshair.update is not a function' in this line: 'crosshair.update();' Line Number: 377
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: navigation.setCurrent is not a function' in this line: 'navigation.setCurrent(currentPlanet);' Line Number: 359
User prompt
Fix Bug: 'ReferenceError: centerX is not defined' in this line: 'arrows[i].x = centerX + arrowOffsets[i].x * distance;' Line Number: 225
Code edit (6 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: moneyDisplay is undefined' in this line: 'moneyDisplay.setAmount(money -= button.cost);' Line Number: 275
Code edit (2 edits merged)
Please save this source code
User prompt
add a new CurrencyText in the top-center of the screen, with the settings of: {x:20, y: 100, anchor:{x:0}}, displaying the money variable
===================================================================
--- original.js
+++ change.js
@@ -139,9 +139,9 @@
function launch(direction) {}
});
var Planet = Container.expand(function (x, y, radius, assetName) {
var self = Container.call(this);
- var perimeter = 2 * Math.PI * radius;
+ var perimeter = MATH_2_PI * radius;
var numPlots = Math.floor(perimeter / (PLOT_SIZE + PLOT_GAP));
var numNodes = numPlots / 4;
var farms = [];
var ship = self.addChild(new Ship(radius, 0));
@@ -152,21 +152,21 @@
self.update = update;
self.launch = launch;
self.x = x;
self.y = y;
- self.rotation = Math.random() * 2 * Math.PI;
+ self.rotation = Math.random() * MATH_2_PI;
self.spin = 0;
;
function update(ticks) {
self.rotation += self.spin;
}
function launch(direction) {}
function createFarms() {
for (var i = 1; i < numPlots; i++) {
- var angle = i / numPlots * 2 * Math.PI;
+ var angle = i / numPlots * MATH_2_PI;
var farmX = radius * Math.cos(angle);
var farmY = radius * Math.sin(angle);
- var rotation = angle + Math.PI / 2;
+ var rotation = angle + MATH_HALF_PI;
farms.push(self.addChild(new Farm(farmX, farmY, rotation)));
}
}
;
@@ -210,14 +210,15 @@
y: 0
}];
for (var i = 0; i < arrowOffsets.length; i++) {
var arrow = self.createAsset('arrow', 'Arrow asset', 0.5, 0.5);
- arrow.rotation = Math.PI / 2 * i;
+ arrow.rotation = MATH_HALF_PI * i;
arrows.push(arrow);
self.addChild(arrow);
}
;
self.setDistance = setDistance;
+ self.rotation = MATH_QUARTER_PI;
self.x = x;
self.y = y;
;
function setDistance(distance) {
@@ -226,9 +227,8 @@
arrows[i].y = arrowOffsets[i].y * distance;
}
}
;
- ;
setDistance(distance);
});
var NavigationButton = Container.expand(function (x, y, index, callback) {
var self = Container.call(this);
@@ -300,9 +300,11 @@
/****
* Game Code
****/
var MATH_2_PI = Math.PI * 2;
-var MATH_R3BY2 = Math.sqrt(3) / 2;
+var MATH_HALF_PI = Math.PI / 2;
+var MATH_QUARTER_PI = Math.PI / 4;
+var MATH_HALF_ROOT_3 = Math.sqrt(3) / 2;
;
var GAME_TICKS = 60;
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
@@ -321,9 +323,9 @@
var ROCKET_SPEED_MAX = 30;
var ROCKET_SPEED_REVERSE = 5;
var PLOT_SIZE = 100;
var PLOT_GAP = 40;
-var TEXT_OFFSETS = [[0, 1], [MATH_R3BY2, 0.5], [MATH_R3BY2, -0.5], [0, -1], [-MATH_R3BY2, -0.5], [-MATH_R3BY2, 0.5], [0, 0]];
+var TEXT_OFFSETS = [[0, 1], [MATH_HALF_ROOT_3, 0.5], [MATH_HALF_ROOT_3, -0.5], [0, -1], [-MATH_HALF_ROOT_3, -0.5], [-MATH_HALF_ROOT_3, 0.5], [0, 0]];
var TEXT_BORDER_WEIGHT = 4;
var TEXT_DEFAULT_SIZE = 50;
var TEXT_DEFAULT_FONT = 'Arial';
var TEXT_DEFAULT_FILL = '#FFFFFF';
pixel art of a tiny planet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a planet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of an alien currency symbol. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a planet made of gold ore. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
plain black background with stars. 2d repeating Texture.
pixel art of a asteroid. Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a cute alien farmer, side view. Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a rocky explosion.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art flame particle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a large white, empty, rectangular, speech bubble. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art of a red chevron. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pixel art of yellow grapes. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.