Code edit (4 edits merged)
Please save this source code
User prompt
in the planet update method, update all nodes as well
Code edit (2 edits merged)
Please save this source code
User prompt
move the fruitList array onto the planet. Instead of updating all fruits on tick callback, update the list in the planet update method
Code edit (2 edits merged)
Please save this source code
User prompt
Fix Bug: 'ReferenceError: angle is not defined' in or related to this line: 'var baseIndex = mod(Math.round(angle / MATH_2_PI * count), count);' Line Number: 161
Code edit (2 edits merged)
Please save this source code
User prompt
add a new action function to plantNodes that checks if its plant exists, and is harvestable and calls the harvest function on it. Returning whether the harvest was callable
User prompt
Replace `// TODO: Create fruit at node's position` with: spawn a new fruit with the self.fruit variable as the name, at the parent node's position and attach it to the planet
Code edit (4 edits merged)
Please save this source code
User prompt
add a harvest function and a harvestable variable to the Plant class
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
create an interval on the player that checks to see which planet node's index is closest to the player's angle every PLAYER_ACTION_INTERVAL ticks
Code edit (16 edits merged)
Please save this source code
User prompt
Rename the globals: PLAYER_PICKUP_DIST and PLAYER_PICKUP_SQRDIST to: PLAYER_ACTION_DIST and PLAYER_ACTION_SQRDIST, and update all old usages of the variables
Code edit (4 edits merged)
Please save this source code
User prompt
destroy and clear the player variable in the launch function if direction > 0
Code edit (1 edits merged)
Please save this source code
User prompt
destroy and clear the player variable on ship launch (in the launch function)
User prompt
destroy and clear the player variable on ship launch
Code edit (1 edits merged)
Please save this source code
User prompt
flip the player's graphic based on the direction it's moving
Code edit (3 edits merged)
Please save this source code
User prompt
rotate the player asset to match it's current angle
===================================================================
--- original.js
+++ change.js
@@ -368,9 +368,9 @@
var perimeter = MATH_2_PI * radius;
var numPlots = Math.floor(perimeter / (PLOT_SIZE + PLOT_GAP));
var numNodes = numPlots / 4;
var nodes = [];
- self.fruitList = [];
+ var fruitList = [];
var planetGraphics = self.createAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
@@ -380,16 +380,15 @@
self.x = x;
self.y = y;
self.nodes = nodes;
self.radius = radius;
+ self.fruitList = fruitList;
self.rotation = Math.random() * MATH_2_PI;
self.spin = 0;
;
function update(ticks) {
self.rotation += self.spin;
- for (var i = 0; i < self.nodes.length; i++) {
- self.nodes[i].update();
- }
+ updateList(nodes);
updateList(self.fruitList);
}
function createNodes() {
if (!barren) {
@@ -970,9 +969,9 @@
;
function updateList(list) {
for (var i = list.length - 1; i >= 0; i--) {
var item = list[i];
- if (item.update && typeof item.update === 'function' && item.update()) {
+ if (item.update && item.update()) {
item.destroy();
list.splice(i, 1);
}
}
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.