User prompt
Migrate to the latest version of LK
Code edit (4 edits merged)
Please save this source code
User prompt
Create a new Debris class extending ConfigContainer. It should have an attached asset, with the following details: id derived from config.image, an x position derived from config.offset, a random rotation, and a random scale between 0.8 and 1.2
Code edit (1 edits merged)
Please save this source code
Code edit (6 edits merged)
Please save this source code
User prompt
In the ship class, tint the asset FFE4B2
Code edit (9 edits merged)
Please save this source code
User prompt
Apply a slight orange tint to the FarmNode's farmGraphics
Code edit (1 edits merged)
Please save this source code
User prompt
the autoweeder should slowly move around the planet at a speed of AUTOWEEDER_SPEED, maintaining a distance of the planets radius
Code edit (1 edits merged)
Please save this source code
User prompt
In the Planet class update, call the autoweeder update if it exists
User prompt
Add a new global AUTOWEEDER_ROTATION = 0.01 (under the existing Autoweeder settings). In the Autowheel class's update function, increase the rotation of the autoweederWheel asset by the AUTOWEEDER_ROTATION
User prompt
When creating an autoweeder, add it to the planet background instead of the planet itself
User prompt
The Autoweeder class needs an asset with id autoweederWheel
User prompt
The Autoweeder class needs an asset with id autoweederWheel, which slowly rotates at a speed of AUTOWEEDER_ROTATION = 0.01 (new global variable under "Autoweeder settings")
Code edit (2 edits merged)
Please save this source code
User prompt
In the NavigationButton's update function, in addition to updating the buttonGraphics. Rotate the planetGraphics by the amount specified in the relevant PLANET_DETAILS
Code edit (1 edits merged)
Please save this source code
User prompt
In the NavigationButton's update function, check if the buttonGraphics rotation is not equal to the targetRotation and rotate (the buttonGraphics) towards the targetRotation at a speed of NAVIGATION_ROTATE_SPEED
Code edit (1 edits merged)
Please save this source code
User prompt
Add a local targetRotation var = 0 to the NavigationButton class
Code edit (1 edits merged)
Please save this source code
User prompt
Add NAVIGATION_ROTATE_SPEED = 0.01 and NAVIGATION_ROTATE_TARGET = MATH_HALF_PI as global variables under the existing "Interface settings" heading
User prompt
Add NAVIGATION_ROTATE_SPEED = 0.01 and NAVIGATION_ROTATE_TARGET = MATH_HALF_PI as global variables under the existing Interface settings heading
===================================================================
--- original.js
+++ change.js
@@ -254,8 +254,13 @@
moneyDisplay.setText(money += amount);
if (collectStats) {
stats.creditsEarned += amount;
}
+ } else if (name === 'autoweeder') {
+ planet.autoweeder = planet.addChild(new Autoweeder({
+ x: ship.x,
+ y: ship.y
+ }));
} else {
inventory.adjustItem(name, amount);
if (collectStats) {
stats.itemsCollected += amount;
@@ -366,11 +371,11 @@
self.x = planet.radius;
self.direction = 0;
LK.setTimeout(function () {
player = planet.addChild(new Player({
- rotation: ship.rotation,
- x: ship.x,
- y: ship.y
+ rotation: self.rotation,
+ x: self.x,
+ y: self.y
}));
}, PLAYER_SPAWN_DELAY);
}
} else if (self.direction > 0) {
@@ -392,8 +397,15 @@
}
function launch(direction) {
if (!self.direction) {
self.direction = direction;
+ // Reject any outstanding trades
+ for (var i = 0; i < 4; i++) {
+ var trader = traders[i];
+ if (trader) {
+ trader.handleTradeCallback(false);
+ }
+ }
}
}
});
var PopupEffect = ConfigContainer.expand(function (fruitName, config) {
@@ -1673,14 +1685,15 @@
self.imageAsset.y = PLOT_BUTTON_OFFSET;
;
return self;
});
-var AutoWeeder = ConfigContainer.expand(function (config) {
+var Autoweeder = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
- // Custom AutoWeeder logic here
- self.update = function () {
- // AutoWeeder update logic
- };
+ ;
+ self.update = update;
+ ;
+ function update() {}
+ ;
return self;
});
var Asteroid = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -1878,8 +1891,10 @@
/****
* Game Code
****/
+// Autoweeder settings
+var AUTOWEEDER_ROTATION = 0.01;
;
//==============================================================================
// Global constants & settings
//==============================================================================
@@ -1927,9 +1942,9 @@
var PLOT_BUTTON_OFFSET = -220;
;
// Interface settings
var NAVIGATION_ROTATE_SPEED = 0.01;
-var NAVIGATION_ROTATE_TARGET = MATH_HALF_PI;
+var NAVIGATION_ROTATE_TARGET = Math.PI;
var SCALE_FRUIT_DROP = 0.8;
var SCALE_FRUIT_INVENTORY = 0.6;
var SCALE_FRUIT_TRADE = 0.65;
var SCALE_FRUIT_PLANTER = 0.25;
@@ -1970,8 +1985,12 @@
var PLAYER_BUFFER_SQRDIST = PLAYER_BUFFER_DIST * PLAYER_BUFFER_DIST;
var PLAYER_START_ANGLE = Math.PI / 16;
var PLAYER_DISTANCE_SCALE = 0.01;
;
+// Autoweeder settings
+var AUTOWEEDER_SPEED = 1;
+var AUTOWEEDER_HEIGHT = 400;
+;
// Trader settings
var TRADER_TIME_INITIAL = 10 * GAME_TICKS;
var TRADER_TIME_MIN = 1 * GAME_TICKS;
var TRADER_TIME_MAX = 30 * GAME_TICKS;
@@ -2303,23 +2322,25 @@
;
function trySpawnTrader() {
if (--traderCountdown <= 0) {
traderCountdown = randomInt(TRADER_TIME_MIN, TRADER_TIME_MAX);
- var available = [];
- for (var i = 0; i < 4; i++) {
- if (!traders[i]) {
- available.push(i);
+ if (!ship.direction) {
+ var available = [];
+ for (var i = 0; i < 4; i++) {
+ if (!traders[i]) {
+ available.push(i);
+ }
}
+ if (available.length > 0) {
+ var spawnIndex = available[Math.floor(Math.random() * available.length)];
+ traders[spawnIndex] = background.addChild(new Trader({
+ index: spawnIndex,
+ x: GAME_WIDTH / 4 * (spawnIndex % 2 === 0 ? 1 : 3),
+ y: GAME_HEIGHT / 32 * (spawnIndex < 2 ? 9 : 27)
+ }, nextTrade));
+ nextTrade = undefined;
+ }
}
- if (available.length > 0) {
- var spawnIndex = available[Math.floor(Math.random() * available.length)];
- traders[spawnIndex] = background.addChild(new Trader({
- index: spawnIndex,
- x: GAME_WIDTH / 4 * (spawnIndex % 2 === 0 ? 1 : 3),
- y: GAME_HEIGHT / 32 * (spawnIndex < 2 ? 9 : 27)
- }, nextTrade));
- nextTrade = undefined;
- }
}
}
;
function transitionPlanets() {
@@ -2331,16 +2352,8 @@
asteroidList.forEach(function (asteroid) {
asteroid.destroy();
});
asteroidList = [];
- for (var i = 0; i < 4; i++) {
- var trader = traders[i];
- if (trader) {
- trader.handleTradeCallback(false);
- trader.destroy();
- }
- }
- traders = [];
if (!planet) {
var planetClass = PLANET_DETAILS[currentPlanet].blueprint;
planet = planetMap[currentPlanet] = new planetClass({
x: GAME_WIDTH / 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.