User prompt
Remove the console.log
Code edit (4 edits merged)
Please save this source code
User prompt
plant class refreshGraphics should also randomly flip the x scale
Code edit (5 edits merged)
Please save this source code
User prompt
When the farmGraphics are clicked, call the tryPlantFruit function
Code edit (3 edits merged)
Please save this source code
User prompt
explosions should have their initial rotation set to face the planet
User prompt
explosions should start with 0.5 alpha and fade it out over its lifetime and also double its scale over its lifetime
User prompt
Create a global effectsList array and call updateList(effectsList) in the on tick callback. Explosion effects should be added to this list in their constructor
User prompt
When asteroids impact, they should create an explosion effect where they landed
User prompt
Move the angle, and fruitX,Y calculations into the if statement for fruitDiamondDust creation
User prompt
Instead of asteroids always creating a diamondDustFruit on impact, add a ASTEROID_DROP_CHANCE global of 0.1 (10% chance)
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- 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.