Code edit (1 edits merged)
Please save this source code
Code edit (17 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: childInstance is undefined' in or related to this line: 'childInstance.x += x;' Line Number: 234
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'self.shift = function (x, y) {' Line Number: 348
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'self.shift = function (x, y) {' Line Number: 342
User prompt
add a "shift" function to the camera which takes in an x and y value. When called, iterate through all the camera's children and increase their x-position by the x value. Additionally increase the Frog instance's y-position by the y value.
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please implement this in the frog class for TODO 1,2 and 3 respectively
Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: r is not defined' in or related to this line: 'var vt = self.angularVelocity * r;' Line Number: 161
User prompt
Please implement this for the frog class. The TODO 1 is when the frog instance attaches to the hook, the TODO 2 is when the frog releases itself from the hook, and the TODO 3 is the angular momentum update while attached to the hook point
User prompt
Please fix the bug: 'ReferenceError: distance is not defined' in or related to this line: 'var angle = self.angularMomentum / distance;' Line Number: 148
User prompt
Please complete TODO 1, 2 and 3. TODO 1 should convert the current velocity into angular momentum, TODO 2 should convert the current angular momentum into velocity, and TODO 3 should update the position based on the angular momentum and also be influenced by player gravity.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
When releasing, convert the tangential velocity into the new vx and vy
User prompt
Similarly apply the tangential velocity solution while the frog is attached to the hook, and revert it once the release function is called
User prompt
Assuming the frog is the body in this example, please add a vx, vy to it, and allow it to be affected by gravity.
User prompt
make the pink tongue a slightly darker pink
Code edit (1 edits merged)
Please save this source code
User prompt
tint the tongue body and tip pink
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -104,14 +104,15 @@
if (hook) {
hooked = true;
sitting = false;
hookedObj = hook;
- // Calculate the angle between the frog and the hook
var dx = self.x - hookedObj.x;
var dy = self.y - hookedObj.y;
hookLength = Math.sqrt(dx * dx + dy * dy);
velocityAngle = Math.atan2(dy, dx);
- angularVelocity = Math.sqrt(velocityX * velocityX + velocityY * velocityY) / hookLength;
+ var direction = Math.atan2(velocityY, velocityX);
+ var magnitude = Math.sin(velocityAngle - direction);
+ angularVelocity = magnitude * Math.sqrt(velocityX * velocityX + velocityY * velocityY) / hookLength;
tongue = tongueContainer.addChild(new FrogTongue({
length: hookLength
}));
self.rotation = velocityAngle + Math.PI;
@@ -212,8 +213,9 @@
childInstance.x -= x;
}
}
foreground.x -= x / 2;
+ frog.x += x;
frog.y += y;
};
self.update = function () {
self.scale.set(zoom);
fireCrackle
Sound effect
frogTongue
Sound effect
frogDeath
Sound effect
lilypadBounce
Sound effect
noTarget
Sound effect
backgroundAmbient
Sound effect
fireCrackling1
Sound effect
fireCrackling2
Sound effect
fireCrackling3
Sound effect
fireCrackling4
Sound effect
frogBounce
Sound effect
pickupCaught
Sound effect