Code edit (9 edits merged)
Please save this source code
User prompt
The TraderDialogue's setTint should flash the dialogueBackground object the tint colour for 500ms
Code edit (9 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: mainAsset.fill is undefined' in or related to this line: 'mainAsset.fill.set(textFill = newFill);' Line Number: 110
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
The traderGraphics should start at scaleX,scaleY of 0,0 and be set in the update statement to: `1 - counter / TRADER_SPAWN_TIME` after setting the position
Code edit (7 edits merged)
Please save this source code
User prompt
The traderGraphics should start at a random point within TRADER_SPAWN_RADIUS, and move towards the 0,0 position over TRADER_SPAWN_TIME
User prompt
Add 5 globals: `TRADER_SPAWN_RADIUS = 1000`, `TRADER_SPAWN_TIME = 2 * GAME_TICKS`, `TRADER_MOVE_ANCHOR = 0.25`, `TRADER_MOVE_ROTATION = 0.15` and `TRADER_MOVE_INTERVAL = 5`
User prompt
Fix Bug: 'ReferenceError: trader is not defined' in or related to this line: 'var traderGraphics = self.attachAsset('trader', {' Line Number: 1300
User prompt
Trader graphics should start off screen and move towards it's 0,0 point
Code edit (1 edits merged)
Please save this source code
Code edit (13 edits merged)
Please save this source code
User prompt
Fix Bug: 'SecurityError: Permission denied to access property "removeChild" on cross-origin object' in or related to this line: 'baseDestroy();' Line Number: 529
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: t is undefined' in or related to this line: 'symbolAsset = self.attachAsset(newSymbol, {' Line Number: 183
Code edit (2 edits merged)
Please save this source code
User prompt
in the transitionPlanets function, destroy all traders and reset the array
User prompt
in the transitionPlanets function, destroy all asteroids and reset the array
Code edit (6 edits merged)
Please save this source code
User prompt
Remove any remaining console logs
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Add an asset with id "point" to BorderedSymbol and SymbolText
===================================================================
--- original.js
+++ change.js
@@ -1256,28 +1256,28 @@
self.update = update;
;
function update() {
if ((LK.ticks - spawnTick) % TRADER_MOVE_INTERVAL === 0) {
- var anchorX = TRADER_MOVE_ANCHOR * (Math.random() * 2 - 1);
- var anchorY = TRADER_MOVE_ANCHOR * (Math.random() * 2 - 1);
+ var anchorX = 0.5 + TRADER_MOVE_ANCHOR * (Math.random() * 2 - 1);
+ var anchorY = 0.5 + TRADER_MOVE_ANCHOR * (Math.random() * 2 - 1);
var rotation = TRADER_MOVE_ROTATION * (Math.random() * 2 - 1);
traderGraphics.anchor.set(anchorX, anchorY);
traderGraphics.rotation = rotation;
}
- if (counter > 0) {
+ if (direction !== 0) {
+ counter -= direction;
traderGraphics.x += moveX * direction;
traderGraphics.y += moveY * direction;
traderGraphics.scale.set(1 - counter / TRADER_SPAWN_TIME);
- if (--counter <= 0) {
- if (direction > 0) {
- traderDialogue = self.addChild(new TraderDialogue(handleTradeCallback, trade, {
- y: -traderGraphics.height / 2 - TRADER_SHIP_SPACING,
- flipX: self.x < GAME_WIDTH / 2 ? -1 : 1
- }));
- } else {
- traders[index] = undefined;
- self.destroy();
- }
+ if (counter <= 0) {
+ direction = 0;
+ traderDialogue = self.addChild(new TraderDialogue(handleTradeCallback, trade, {
+ y: -traderGraphics.height / 2 - TRADER_SHIP_SPACING,
+ flipX: self.x < GAME_WIDTH / 2 ? -1 : 1
+ }));
+ } else if (counter >= TRADER_SPAWN_TIME) {
+ traders[index] = undefined;
+ self.destroy();
}
}
}
function handleTradeCallback(accepted) {
@@ -1292,10 +1292,9 @@
} else {
closeDialogue = true;
}
if (closeDialogue) {
- direction = 0;
- counter = TRADER_SPAWN_TIME;
+ direction = -1;
traderDialogue.destroy();
}
}
function generateTrade() {
@@ -1457,8 +1456,9 @@
// Game constants
var GAME_TICKS = 60;
var GAME_WIDTH = 2048;
var GAME_HEIGHT = 2732;
+var GAME_SPEED = 0.1;
;
// Rocket constants
var ROCKET_DIST_REVERSE = 300;
var ROCKET_DIST_LEAVE = 2500;
@@ -1516,10 +1516,10 @@
var PLAYER_START_ANGLE = Math.PI / 16;
;
// Trader settings
var TRADER_TIME_INITIAL = 15 * GAME_TICKS;
-var TRADER_TIME_BASE = 10 * GAME_TICKS;
-var TRADER_TIME_VARIANCE = 80 * GAME_TICKS;
+var TRADER_TIME_MIN = 10 * GAME_TICKS;
+var TRADER_TIME_MAX = 50 * GAME_TICKS;
var TRADER_COST_VARIANCE = 0.1;
var TRADER_INVENTORY_MIN = 0.25;
var TRADER_INVENTORY_MAX = 1.5;
var TRADER_FRUIT_OFFER_MIN = 1;
@@ -1528,11 +1528,11 @@
var TRADER_FRAME_OFFSET_X = 0.1;
var TRADER_FRAME_OFFSET_Y = -0.56;
var TRADER_DETAIL_MARGIN = 20;
var TRADER_SHIP_SPACING = 50;
-var TRADER_MOVE_INTERVAL = 5;
-var TRADER_MOVE_ROTATION = 0.15;
-var TRADER_MOVE_ANCHOR = 0.25;
+var TRADER_MOVE_INTERVAL = 20;
+var TRADER_MOVE_ROTATION = 0.1;
+var TRADER_MOVE_ANCHOR = 0.1;
var TRADER_SPAWN_TIME = 2 * GAME_TICKS;
var TRADER_SPAWN_RADIUS = 1000;
;
// Plant settings
@@ -1808,9 +1808,9 @@
}
;
function trySpawnTrader() {
if (--traderCountdown <= 0) {
- traderCountdown = Math.floor(TRADER_TIME_BASE + Math.random() * TRADER_TIME_VARIANCE);
+ traderCountdown = randomInt(TRADER_TIME_MIN, TRADER_TIME_MAX);
var available = [];
for (var i = 0; i < 4; i++) {
if (!traders[i]) {
available.push(i);
@@ -1820,9 +1820,9 @@
var spawnIndex = available[Math.floor(Math.random() * available.length)];
traders[spawnIndex] = foreground.addChild(new Trader({
index: spawnIndex,
x: GAME_WIDTH / 4 * (spawnIndex % 2 === 0 ? 1 : 3),
- y: GAME_HEIGHT / 8 * (spawnIndex < 2 ? 2 : 7)
+ y: GAME_HEIGHT / 32 * (spawnIndex < 2 ? 8 : 27)
}, nextTrade));
nextTrade = 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.