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,19 +8,29 @@
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 + '\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 messages = [' + 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 messageTime = self.addChild(new BorderedText('You reached the Gold Planet in: ' + winningTime, {
+ y: -400,
+ anchor: {
+ x: .5,
+ y: 1
+ }
+ }));
var headingText = self.addChild(new BorderedText('Congratulations, you win!', {
size: 80,
+ y: messageTime.y - messageTime.height - 10,
anchor: {
- x: 0.5
+ x: .5,
+ y: 1
}
}));
- var messageText = self.addChild(new BorderedText(messages.join('\n'), {
- y: headingText.height + 10,
+ var messageStats = self.addChild(new BorderedText(messages.join('\n'), {
+ y: 400,
anchor: {
- x: 0.5
+ x: .5,
+ y: 0
}
}));
;
self.x = x;
@@ -403,15 +413,14 @@
buttonCallback(0);
});
var Background = Container.expand(function () {
var self = Container.call(this);
- var backgroundGraphics = LK.getAsset('background', {
+ var backgroundGraphics = self.attachAsset('background', {
anchorX: 0.5,
anchorY: 0.5
});
backgroundGraphics.width = GAME_WIDTH * 1.05;
backgroundGraphics.height = GAME_WIDTH * 1.05;
- self.addChild(backgroundGraphics);
;
self.x = GAME_WIDTH / 2;
self.y = GAME_HEIGHT / 2;
});
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.