Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: self.attachAsset is not a function' in this line: 'var backgroundGraphics = self.attachAsset('background', {' Line Number: 407
Code edit (1 edits merged)
Please save this source code
User prompt
the background should be positioned in the middle of the screen and be sized to it's width
Code edit (1 edits merged)
Please save this source code
User prompt
Add a background image to the game
Code edit (2 edits merged)
Please save this source code
User prompt
In the Planet's createNodes functions, there should be a 20% chance of creating a PlantWeed with a random stage (between 0-3) and attach it to the node
User prompt
PlantWeed should have a graphic with id defined as: `'plant0Stage'+stage`
Code edit (2 edits merged)
Please save this source code
User prompt
Create a new Plant class, and a new PlantWeed class that inherits from the Plant class
Code edit (3 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: createFarms is not defined' in this line: 'createFarms();' Line Number: 223
User prompt
Rename the Planet class's `createFarms` function to `createNodes`, increase the number of iterations to `numPlots * 4` and create `PlantNode`s instead of `Farm`s
Code edit (1 edits merged)
Please save this source code
User prompt
Add an update function to the PlantNode class
User prompt
Create a new, empty PlantNode class
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -8,18 +8,17 @@
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 messages = ['You reached the Gold Planet in: ' + winningTime + '\n', ' + 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,
+ size: 80,
anchor: {
x: 0.5
}
}));
var messageText = self.addChild(new BorderedText(messages.join('\n'), {
y: headingText.height + 10,
- size: 60,
anchor: {
x: 0.5
}
}));
@@ -145,18 +144,18 @@
alignText();
});
var Farm = Container.expand(function (x, y, rotation) {
var self = Container.call(this);
- var farmGraphics = self.createAsset('farm', 'Farm asset', 0.5, 0.65);
- farmGraphics.width = PLOT_SIZE;
+ var farmGraphics = self.createAsset('farm', 'Farm asset', .5, .6);
+ farmGraphics.scale.set(PLOT_SIZE / 100);
;
self.x = x;
self.y = y;
self.rotation = rotation;
});
var Ship = Container.expand(function (x, y) {
var self = Container.call(this);
- var shipGraphics = self.createAsset('ship', 'Ship asset', 0.35, 0.5);
+ var shipGraphics = self.createAsset('ship', 'Ship asset', .35, .5);
var counter = 0;
;
self.update = update;
self.launch = launch;
@@ -386,10 +385,10 @@
var ROCKET_SPEED_BASE = 1.2;
var ROCKET_SPEED_DIV = 5;
var ROCKET_SPEED_DELAY = 10;
var ROCKET_SPEED_REVERSE = 2;
-var PLOT_SIZE = 100;
-var PLOT_GAP = 40;
+var PLOT_SIZE = 65;
+var PLOT_GAP = 90;
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';
@@ -473,10 +472,9 @@
if (currentPlanet === NAVIGATION.length - 1) {
if (winningTick < 0) {
winningTick = LK.ticks;
}
- winningMessage = new WinningMessage(GAME_WIDTH / 2, GAME_HEIGHT / 2 + 300, winningTick);
- game.addChild(winningMessage);
+ winningMessage = LK.gui.center.addChild(new WinningMessage(0, -100, winningTick));
} 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.