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
@@ -1,20 +1,32 @@
/****
* Classes
****/
-var WinningMessage = Container.expand(function (winningTime) {
+var WinningMessage = Container.expand(function (x, y, completionTicks) {
var self = Container.call(this);
- var messageText = self.addChild(new BorderedText('Congratulations, you win!\nYou reached the gold planet in: ' + winningTime, {
+ var seconds = Math.floor(completionTicks / 60);
+ var minutes = Math.floor(seconds / 60);
+ var hours = Math.floor(minutes / 60);
+ seconds = seconds % 60;
+ minutes = minutes % 60;
+ var winningTime = hours + 'h ' + minutes + 'm ' + seconds + 's';
+ var messages = ['You reached the gold planet in: ' + winningTime, ' + Crops Harvested:' + stats.cropsHarvested, ' + Crops Overrun:' + stats.cropsOverrun, ' + Weeds Pulled: ' + stats.weedsPulled, ' + Credits Earned: ' + stats.creditsEarned, ' + Successful Sales: ' + stats.salesDone, ' + Sales Rejected: ' + stats.salesRejected];
+ var headingText = self.addChild(new BorderedText('Congratulations, you win!', {
+ size: 100,
+ anchor: {
+ x: 0.5
+ }
+ }));
+ var messageText = self.addChild(new BorderedText(messages.join('\n'), {
+ y: headingText.height + 10,
size: 60,
anchor: {
- x: 0.5,
- y: 0.5
+ x: 0.5
}
}));
- messageText.x = GAME_WIDTH / 2;
- messageText.y = GAME_HEIGHT - 500;
- self.update = function () {};
- return self;
+ ;
+ self.x = x;
+ self.y = y;
});
var BorderedText = Container.expand(function (string, settings) {
var self = Container.call(this);
settings = settings || {};
@@ -414,8 +426,17 @@
description: 'A wealthy planet with vast resources.'
}];
;
var money = 10000;
+var stats = {
+ cropsHarvested: 0,
+ cropsOverrun: 0,
+ weedsPulled: 0,
+ creditsEarned: 0,
+ salesDone: 0,
+ salesRejected: 0
+};
+var winningStats;
var winningTick = -1;
var winningTime = '';
var winningMessage;
var currentPlanet = 0;
@@ -451,16 +472,10 @@
}
if (currentPlanet === NAVIGATION.length - 1) {
if (winningTick < 0) {
winningTick = LK.ticks;
- var seconds = Math.floor(winningTick / 60);
- var minutes = Math.floor(seconds / 60);
- var hours = Math.floor(minutes / 60);
- seconds = seconds % 60;
- minutes = minutes % 60;
- winningTime = hours + 'h ' + minutes + 'm ' + seconds + 's';
}
- winningMessage = new WinningMessage(winningTime);
+ winningMessage = new WinningMessage(GAME_WIDTH / 2, GAME_HEIGHT / 2 + 300, winningTick);
game.addChild(winningMessage);
} else if (winningMessage) {
winningMessage.destroy();
winningMessage = undefined;
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.