Code edit (12 edits merged)
Please save this source code
User prompt
Instead of calling `planet.update()` in the onTick callback, iterate through the planetMap object and update all planets
Code edit (1 edits merged)
Please save this source code
Code edit (17 edits merged)
Please save this source code
User prompt
add a global PLANT_DEAD_COLOUR variable which is a hex-tint for brown
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
Create a new UprootButton class that has the same logic as the PlanterButton
User prompt
Duplicate the PlanterButton as UprootButton and PlanterButton classes
Code edit (9 edits merged)
Please save this source code
User prompt
Please remove PLOT_EXTRA_LINGER
Code edit (4 edits merged)
Please save this source code
User prompt
When collecting a fruit, create a PopupEffect (adding it to the effectsList) above the player
User prompt
create a PopupEffect class inheriting from the ConfigContainer class and taking in a fruitName and config params. The class contains a SymbolText element which slowly increases it's y value and disappears after 1 second
Code edit (1 edits merged)
Please save this source code
User prompt
after performing the player collection check, fruit should fall towards the planet at a fixed rate, stopping when it reaches the planet's radius distance
User prompt
fruit should fall towards the planet at a fixed rate
Code edit (9 edits merged)
Please save this source code
User prompt
In the planterButtonCallback function, instead of setting the targetPoint to 0, set targetPoint to the angle between the planet and the self's positions
Code edit (1 edits merged)
Please save this source code
User prompt
When a fruit is collected, increment the cropsHarvested stat
User prompt
When the trader buttoncallback is called, increment the salesRejected stat if the accepted param is false, otherwise increment the salesDone stat if it was fully completed
User prompt
When an asteroid impacts the planet, increase the stats.asteroidImpacts value by 1
Code edit (10 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: trader.handleTradeCallback is not a function' in or related to this line: 'trader.handleTradeCallback(false);' Line Number: 1946
===================================================================
--- original.js
+++ change.js
@@ -881,37 +881,39 @@
var hours = Math.floor(minutes / 60);
seconds = seconds % 60;
minutes = minutes % 60;
var winningTime = (hours > 0 ? hours + 'h ' : '') + (minutes > 0 ? minutes + 'm ' : '') + seconds + 's';
- var messageStatTitles = ['Credits', 'Harvests', 'Weeds', 'Trades'];
- var messageStatKeys = ['creditsEarned', 'cropsHarvested', 'weedsPulled', 'salesDone'];
+ var messageStatTitles = ['Distance Walked', 'Credits Earned', 'Items Harvested', 'Crops Overrun', 'Weeds Pulled', 'Trades Accepted', 'Trades Declined', 'Asteroid Impacts'];
+ var messageStatKeys = ['distanceRun', 'creditsEarned', 'cropsHarvested', 'cropsOverrun', 'weedsPulled', 'salesDone', 'salesRejected', 'asteroidImpacts'];
var timeText = self.addChild(new BorderedText('You reached the Gold Planet in: ' + winningTime, {
anchorX: .5,
anchorY: 1,
y: -TEXT_WINNING_OFFSET
}));
self.addChild(new BorderedText('Congratulations, you win!', {
anchorX: .5,
anchorY: 1,
- size: 80,
+ size: TEXT_SIZE_LARGE,
y: timeText.y - timeText.height - 10
}));
self.addChild(new BorderedText(messageStatTitles.map(mapTitle).join('\n'), {
anchorX: 1,
anchorY: 0,
+ size: TEXT_SIZE_SMALL,
y: TEXT_WINNING_OFFSET
}));
self.addChild(new BorderedText(messageStatKeys.map(mapKey).join('\n'), {
anchorX: 0,
anchorY: 0,
+ size: TEXT_SIZE_SMALL,
y: TEXT_WINNING_OFFSET
}));
;
self.x = x;
self.y = y;
;
function mapTitle(title) {
- return '• ' + title + ' ';
+ return title + ' ';
}
function mapKey(key) {
var stat = winningStats[key];
var extra = stat - stats[key];
@@ -1032,9 +1034,9 @@
var itemDetails = FRUIT_DETAILS[selection];
var allowedTypes = PLANET_DETAILS[planet.name].plantTypes;
allowed = allowedTypes.includes(itemDetails.type);
if (!allowed) {
- var warning = planet.barren ? GROW_WARNING_BARREN : GROW_WARNING_GENERAL;
+ var warning = planet.barren ? GROW_WARNING_BARREN : !itemDetails.type || !itemDetails.plant ? GROW_WARNING_DIAMOND : GROW_WARNING_GENERAL;
warningText.setText(warning);
}
}
self.allowed = allowed;
@@ -1185,8 +1187,9 @@
x: self.x,
y: self.y,
scale: randomScale
}));
+ stats.asteroidImpacts++;
return true;
}
return side ? self.x > targetX : self.x < targetX;
}
@@ -1512,8 +1515,9 @@
var SCALE_FRUIT_TRADE = 0.65;
var SCALE_FRUIT_PLANTER = 0.3;
var TEXT_WINNING_OFFSET = 300;
var TEXT_SIZE_SMALL = 35;
+var TEXT_SIZE_LARGE = 75;
var CROSSHAIR_DIST = 40;
var CROSSHAIR_VARIANCE = 10;
var CROSSHAIR_PERIOD = 1.25 * GAME_TICKS / MATH_2_PI;
;
@@ -1571,9 +1575,10 @@
var WEEDS_SPAWN_VARIANCE = 2 * 60 * GAME_TICKS;
var WEEDS_SPREAD_TIME = 1 * 60 * GAME_TICKS;
var WEEDS_SPREAD_VARIANCE = 20 * GAME_TICKS;
var GROW_WARNING_BARREN = 'Nothing grows on this planet';
-var GROW_WARNING_GENERAL = 'This cannot grow on this plant';
+var GROW_WARNING_GENERAL = 'This cannot grow on this planet';
+var GROW_WARNING_DIAMOND = 'This cannot be planted, only sold';
var PLANT_GROWTH_FACTOR = 0.1;
var PLANT_BUTTON_OFFSET = -220;
var PLANT_FRUIT_SCALE = 0.6;
var PLANT_DETAILS = {
@@ -1651,11 +1656,9 @@
type: 'omni',
plant: 'plantDiamond'
},
fruitDiamond: {
- value: 250,
- type: 'none',
- plant: 'none'
+ value: 250
}
};
;
// Planet & navigation settings
@@ -1722,9 +1725,10 @@
cropsOverrun: 0,
weedsPulled: 0,
salesDone: 0,
salesRejected: 0,
- distanceRun: 0
+ distanceRun: 0,
+ asteroidImpacts: 0
};
var winningStats = {};
var winningTick = -1;
var winningTime = '';
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.