User prompt
When selecting the spider's branch, select among those located on the first 2/3 of the screen, away from the monkey
User prompt
Change spider distance from self.height to double it
User prompt
spider originalY must be setup on setupLevel
User prompt
The spider Y position should ping-pong between its original Y position and the (original Y position + height)
User prompt
The spider should keep it's original position and move relative to that
User prompt
I think there's no call to spider update
User prompt
The spider should move slowly down and slowly back up
User prompt
There's a problem, you are creating a setTimeout at every spider update on idle and moveDown states
User prompt
Use a state machine for the spider update, with a switch case
User prompt
Fix Bug: 'Uncaught ReferenceError: spiders is not defined' in this line: 'for (var i = 0; i < spiders.length; i++) {' Line Number: 150
User prompt
Let's have a new enemy type: spiders. On setupLevel, remove any existing spiders and add exactly one. A spider should sit right below one randomly selected branch. The spider should stay idle 2 seconds, then move down a distance of it's own height, sit idle for 2 seconds again, then go back up its original position
User prompt
on setupLevel, remove all bananas before adding new ones
User prompt
bananaTxt.anchor.set should be (1, 0);
User prompt
Move level indicator to top left corner with half the size. Banana's indicator half the size too
User prompt
Fix Bug: 'Uncaught ReferenceError: bananas is not defined' in this line: 'bananas.push(newBanana);' Line Number: 119
User prompt
Add a bananas indicator on the top right corner. When the monkey touches a banana, it disappears and the indicator increases its number
User prompt
on setupLevel, sprinkle 5 bananas randomly around the level that the monkey can collect
User prompt
Remove branches.length > 0 as condition for jump
User prompt
Monkey's jump function should receive not just a branch parameter, but branches, containing all branches currently intersected with monkey
User prompt
Fix Bug: 'ReferenceError: branches is not defined' in this line: 'for (var i = 0; i < branches.length; i++) {' Line Number: 51
User prompt
On jump, set jumpingFrom with all branches intersecting with monkey, not just one branch
User prompt
Make jumpingFrom an array containing all intersecting branches with monkey. Adjust the code as necessary
User prompt
Invert monkey sprite flipping condition
User prompt
✅ Flip the monkey sprite horizontally when its X direction is -1
User prompt
Flip the monkey sprite horizontally when its X direction is 1
===================================================================
--- original.js
+++ change.js
@@ -156,9 +156,12 @@
spiders[i].destroy();
}
spiders = [];
var newSpider = new Spider();
- var randomBranch = branches[Math.floor(Math.random() * branches.length)];
+ var eligibleBranches = branches.filter(function (branch) {
+ return branch.y < 2 / 3 * 2732 && branch.y > monkey.y + monkey.height;
+ });
+ var randomBranch = eligibleBranches[Math.floor(Math.random() * eligibleBranches.length)];
newSpider.x = randomBranch.x;
newSpider.y = randomBranch.y + randomBranch.height;
newSpider.originalY = newSpider.y;
self.addChild(newSpider);
A tree branch with green leaves Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A preying white bird flying ahead Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A cute monkey with arms up Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Wood texture Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bananas Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoony looking spider, with two big round eyes Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
One green vine Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.